From the course: Docker for Data Engineers

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Running multiple containers from the same image

Running multiple containers from the same image - Docker Tutorial

From the course: Docker for Data Engineers

Running multiple containers from the same image

We've discussed this fact earlier that you can override the command specified by the command directive in your Dockerfile when you run the command to start your container from an image, and that's exactly what I've done here. Now I use the docker run command to bring up a second container from the same my-python-app image. Let's see what the differences are here in this second container. The first is the name of the container. It's my-second-python-app container. The second difference is that I mapped Port 5000 of the Docker container to Port 7000 on my local machine. This means that this app running within the second container will not clash with the first app that I already have running within my first container that's running on Port 5000. This app will run on Port 7000 of my local machine. The third difference here is, notice the last input argument, second_app.py. This will override the argument specified by the command instruction that you can see in the inset picture on line…

Contents