简体   繁体   中英

2 docker containers run in 1 container

i try to start two detached containers.

first a MySql

docker run -td --name mysql -p 3306:3306 -e MYSQL_PASS="admin" tutum/mysql

the i try to start a self built container for apache, typo3

docker run -td --name typo -p 80:80 --link mysql:mysql thomasm/typo3-45

i would now expect that the two containers show up in docker ps

$ docker ps
CONTAINER ID        IMAGE                COMMAND             CREATED             STATUS              PORTS                    NAMES
96607b9ee0f9        tutum/mysql:latest   "/run.sh"           19 minutes ago      Up 19 minutes       0.0.0.0:3306->3306/tcp   mysql,typo/mysql

but both seem to be in this one container id (watch the NAMES column).

docker ps -a now shows that the "typo" container has exited

$ docker ps -a
CONTAINER ID        IMAGE                           COMMAND                CREATED             STATUS                          PORTS                    NAMES
4d5ab7351d49        thomasm/typo3-45:latest         "/start.sh"            8 minutes ago       Exited (0) 8 minutes ago                                 typo          

I'm a bit confused. Why does the typo name show up in the names column of the mysql container. And why does the typo container exit? I don't see any error messages. Non detached, with bash the typo container works...

output from docker logs

$ docker logs typo 
* Starting web server apache2                                                  
AH00558:      apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.16. 
Set the 'ServerName' directive globally to suppress this message

*

Why does the typo name show up in the names column of the mysql container

because they are linked together

why does the typo container exit?

You might find clues by running docker logs typo . A common mistake is to have the container run the process in the background instead of in the foreground.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM