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 - 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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Building your first Docker image5m 46s
-
(Locked)
Overriding the CMD instruction1m 52s
-
(Locked)
Using the Python base image5m 18s
-
(Locked)
Running a container in interactive mode2m 29s
-
(Locked)
Specifying the Dockerfile to run a Python application6m 36s
-
(Locked)
Running the containerized Python application5m 7s
-
(Locked)
Running multiple containers from the same image3m 28s
-
(Locked)
Building an image that runs a setup script6m 14s
-
(Locked)
Overriding the ENTRYPOINT directive4m 38s
-
(Locked)
-
-
-