
Here is the second post from WordPress Migration Saga, a series that presents the migration of an existing WordPress website to another host, in Docker.
To find out about the migration context and the prerequisites for this kind of migration, read the first part, The Beginnings.
Let’s get Docker installed on our server. Below we can see instructions for Linux, more details for various operating systems can be found at Docker Engine.
Let’s install Docker Compose on our server. See Install Docker Compose
If you don’t want to use docker
for any elevated docker command, you can add the user to the docker group. See Post-installation steps for Linux
Now that we have installed Docker, let’s run a few commands, to get to know Docker. There is a vast list of commands available here.
If we wanted to launch a container, we need to run the following command:
The command above just launched your first Docker container.
Now you can list all Docker containers with ps -a
, or only a specific number using ps -n 7
and get info about them using the first characters of the container id and inspect
or logs
.
You can rename a container using rename
, and connect to a container using exec
.
Then stop and remove the container:
Containers, just like with git and GitHub, can be put under versioning, and the changes can be pushed to Docker Hub, in public repositories (or paid private repositories).
Other commands:
What about Docker Compose? In a test folder, create a YAML file named docker-compose.yml, and run docker-compose up
to start and run the application, with the option -d
to detach it and run in background.
Other useful commands for development and testing. If you have created all kind of containers for testing purposes, now it is time to clean your host, before starting the real work. Don’t use those commands after you have created your websites, though!
You can test Docker commands online, too, using Play with Docker.

In the next post, Step By Step Guide for Ubuntu 18.04, we will see step by step how the migration of an existing WordPress website in Docker can be made on Linux.