29
loading...
This website collects cookies to deliver better user experience
docker tag python-helloworld importhuman/python-helloworld:v1.0.0
docker tag
command, we take our local image, python-helloworld
, and give it the name importhuman/python-helloworld:v1.0.0
. Here,importhuman
is the name of my DockerHub account. This is needed to decide which account the image is pushed to. Replace this with your account name.
python-helloworld
is the image I want to push. This is also the name that will be given to the DockerHub repository. Replace this with the name you gave your image (see previous post in this series).v1.0.0
is the tag name. Tags are used to version images.docker images
, we should see both our local image and the newly tagged image.docker login
, and input your username and password.)docker push importhuman/python-helloworld:v1.0.0
docker pull importhuman/python-helloworld:v1.0.0
docker run -d -p 8080:5000 importhuman/python-helloworld:v1.0.0
-d
runs the container in "detached mode". This essentially starts the container while leaving you free to run other commands in the terminal window. Without this flag (foreground mode), the terminal attaches to the process’s standard input, output, and standard error. (Source: Docker)-p 8080:5000
specifies that host port 8080 is connected to container port 5000. The container port here is 5000 as it is the default port exposed by Flask. Thus, if we open "localhost:8080" in a browser, we'll see the expected "Hello World!" output.importhuman/python-helloworld:v1.0.0
is the image we want to run in a container (a local image can be used rather than the tagged version as well).docker ps
docker stop <container-id>
docker stop <container-name>