How to Host Multiple Docker Containers on a Single Droplet with Nginx Reverse Proxy?
Step 1 - run your Docker containers For the same of simplicity, I will run a simple and I’ll run 2 small httpd containers. Run your first container and map port 8080 on your host: docker run -dit --name container-1 -p 8080:80 httpd:2.4 Now if you visit http:// your-dropets-ip :8080, you should be able to see a message saying It Works! . Just so that we could differentiate the two containers, let’s update the It works! message with Container 1 for example: First get your container ID docker ps Then run the following sed command to update the message: docker exec CONTAINER_ID sed -i 's/It works!/Container 1/' /usr/local/apache2/htdocs/index.html This would basically run a search and replace for the It works! string and update it with Container 1 in the default index.html file in the container itself. If you visit your Droplet’s IP again in your browser the message should change fr...