mysql with Exited(1) from docker

2019-07-23 09:05发布

问题:

Start learning docker and try to setup a mysql container. But it dies immediately with Exited(1).

Following is the command used

docker run mysql -e MYSQL_ROOT_PASSWORD=password1

Looking at docker ps, it does not show any running docker container

with docker ps -a returns the following :

CONTAINER ID    IMAGE   COMMAND                     CREATED             STATUS                          PORTS    NAMES
e681f56c52e2    mysql   "/entrypoint.sh -e MY"      3 seconds ago       Exited(1) 3 seconds ago                  lonely_rosalind

Nothing shows up for docker logs lonley_rosalind either

Any idea how to determine why if failed ?

I am running

  • ubuntu 15.04
  • docker version 1.9.1 build a34a1d5

回答1:

Try this

docker run -e MYSQL_ROOT_PASSWORD=password1 mysql

When you are writing something after docker image name docker accepts it as a command for execution in your created container. Pattern for docker run:

docker run [OPTIONS] IMAGE [COMMAND] [ARG...]


标签: mysql docker