0

Just getting started, want to run the downloaded version of mysql:

root:~# 
root:~# docker images
REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE
basex/basexhttp      latest              3339bf6bc898        4 days ago          226MB
twilio/twilio-java   latest              611ab7ece1cf        12 days ago         993MB
mysql                latest              0d64f46acfd1        3 weeks ago         544MB
jetty                latest              5f997007f18d        4 weeks ago         522MB
hello-world          latest              bf756fb1ae65        8 months ago        13.3kB
root:~# 
root:~# docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

root:~# 
root:~# docker run mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password 
2020-09-01 06:53:03+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.21-1debian10 started.
2020-09-01 06:53:03+00:00 [ERROR] [Entrypoint]: mysqld failed while attempting to check config
    command was: mysqld -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password --verbose --help
    Enter password: mysqld: Can not perform keyring migration : Invalid --keyring-migration-source option.
2020-09-01T06:53:03.366882Z 0 [ERROR] [MY-011084] [Server] Keyring migration failed.
2020-09-01T06:53:03.368621Z 0 [ERROR] [MY-010119] [Server] Aborting
root:~# 

Without re-downloading the image.

3

As the documentation clearly states docker run command should be invoked as follows:

docker run [OPTIONS] IMAGE[:TAG|@DIGEST] [COMMAND] [ARG...]

so when you run

docker run mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password

Docker assumes -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password is a command you want to run inside the container, not a list of options for docker run command.

The proper docker run invocation with the parameters you specified is:

docker run -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password mysql

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.