A tricky thing when you’re starting with docker is you may have your container working perfectly well, but after you restart the container, it doesn’t seem to work anymore. When you have multiple processes running in a single container (like we did for our LAMP example), you’ll often have to restart these processes after stopping a container. To illustrate this point, follow these steps below:

Make sure your container is running:

docker start your_container_name

Open a shell inside your running container:

docker attach your_container_name

View the process that are currently running in the container by typing:

top

You may see several running commands with different Process IDs (PIDs). You can exit out of “top” by press “q”.

If you are running a LAMP stack, it’s essential that you check for processes like ‘apache2’ and ‘mysql’. Those services may not be started automatically if you stopped your container, so restart those to get everything working again:

service apache2 start
service mysql start