Deploying MySQL on Linux with Docker For example, to start a new Docker container for the MySQL Community Server, use this command: To start a new Docker container for the MySQL Enterprise Server with a Docker image downloaded from the OCR, use this command: To start a new Docker container for the MySQL Enterprise Server with a Docker image downloaded from My Oracle Support, use this command: If the Docker image of the specified name and tag has not been downloaded by an earlier  docker pull or  docker run  command, the image is now downloaded. Initialization for the container begins, and the container appears in the list of running containers when you run the  docker ps  command. For example: docker run --name=mysql1 --restart on-failure -d mysql/enterprise-server:8.0 docker run --name=mysql1 --restart on-failure -d container-registry.oracle.com/mysql/enterprise-server:8.0 docker run --name=mysql1 --restart on-failure -d mysql/mysql-server:8.0 docker logs mysql1 shell>  docker logs mysql1 2>&1 | grep GENERATED GENERATED ROOT PASSWORD: Axegh3kAJyDLaRuBemecis&EShOs Once initialization is finished, the command’s output is going to contain the random password generated for the root user; check the password with, for example, this command: The  -d  option used in the  docker run  command above makes the container run in the background. Use this command to monitor the output from the container: The container initialization might take some time. When the server is ready for use, the  STATUS  of the container in the output of the  docker ps  command changes from  (health: starting)  to (healthy) . shell>  docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS a24888f0d6f4 mysql/mysql-server "/entrypoint.sh my..." 14 seconds ago Up Connecting to MySQL Server from within the Container docker exec -it mysql1 mysql -uroot -p mysql>  ALTER USER ’root’@’localhost’ IDENTIFIED BY ’ password ’; Once the server is ready, you can run the  mysql  client within the MySQL Server container you just started, and connect it to the MySQL Server. Use the  docker exec -it  command to start a  mysql  client inside the Docker container you have started, like the following: When asked, enter the generated root password (see the last step in Starting a MySQL Server Instance above on how to find the password). Because the  MYSQL_ONETIME_PASSWORD  option is true by default, after you have connected a  mysql  client to the server, you must reset the server root password by issuing this statement: Substitute  password  with the password of your choice. Once the password is reset, the server is ready for use. Container Shell Access To have shell access to your MySQL Server container, use the  docker exec -it  command to start a bash shell inside the container: shell>  docker exec -it mysql1 bash bash-4.2# 185