

To run the above Docker run command in “detached” mode (meaning you can do Now that you’ve got a simple example running, you can shut it down and set someĪdvanced options. MoreĮnvironmental options can be found in their documentation on Docker wordpress is the name of the official Docker image for Wordpress.SELECT host, user FROM er WHERE userivan You should see two rows, like these.


When youre logged in to MySQL from your machine, do this. To try it out: version: 3.3 services: db: image: mysql:5.7 volumes: - dbdata:/var/lib/mysql restart: always environment: MYSQLROOT. You need the second one for your WordPress instance to get access to MySQL. This is also applied here: Setting up WordPress with Docker. Sets environmental variables for our database connection in the WordpressĬontainer. However, as long as you have both the database and your wp-content folder, you can always get your site back, even if everything else was lost. -link database:mysql tells the new Wordpress container to link to theĮxisting database container, but to map it to the hostname mysql.Like, but it helps us identify the container if we want to log into it later. -name wp-local is a name for this container.Save your files in a volume, you may want to keep the container so you can -rm will remove the container after it shuts down.docker run is Docker’s command to run a new container.Let’s dig into this Docker command in more detail so you can optimize it for Once the Wordpress container is started you can complete the installation at Wordpress is ready to finish its installation. That slows down, head over to and check it out. When you run the above command, you should see some terminal output, but once Docker run -rm -name wp-local -link database:mysql -e WORDPRESS_DB_USER=admin -e WORDPRESS_DB_PASSWORD=P^RKvF -e WORDPRESS_DB_NAME=wordpress -p 8080:80 wordpress
