Docker Community Forums

Share and learn in the Docker community.

Problem going through Docker Tutorial

(Monterey) #1

I am following the Get Started, Part 2: Containers tutorial, and reached the point where the python app is built:

docker build -t friendlyhello .
Sending build context to Docker daemon  4.608kB
Step 1/7 : FROM python:2.7-slim
2.7-slim: Pulling from library/python
d13d02fa248d: Pull complete
a2c103c31b60: Pull complete
33bfff8f2f5e: Pull complete
5b66f3cbc9f3: Pull complete
Digest: sha256:1f9abab4af336c05eb13091aa7d704b8044090e022081d950bb507a801ca378a
Status: Downloaded newer image for python:2.7-slim
 ---> b0259cf63993
Step 2/7 : WORKDIR /app
 ---> a3912b26a3f0
Removing intermediate container af840ebc5e3f
Step 3/7 : ADD . /app
Successfully built 15a47ef95a79
Successfully tagged friendlyhello:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories

The image is present

λ docker image ls
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
friendlyhello       latest              15a47ef95a79        28 seconds ago      148MB
hello-world         latest              f2a91732366c        2 hours ago         1.85kB
python              2.7-slim            b0259cf63993        2 weeks ago         138MB
busybox             latest              6ad733544a63        2 weeks ago         1.13MB

However, the final command docker run -p 4000:80 friendlyhello results with no response to the console and the browser pointed to http://localhost:4000/ says ‘This site can’t be reached’.

I am running this tutorial on Windows 10 PRO (Version 1709, build 16299.19), Docker Version 17.09.0-ce-win33 (13620) and using cmder as my console.

How to move forward from here? Obviously, my experience with Docker is miniscule and any help would be appreciated.

(Rahulishu1993) #2

hi @monterey, if there is nothing wrong with the Dockerfile, try to push the image to a repository in docker hub, and then delete the local image. Then try to run this image by fetching it from dockerhub.

(Monterey) #3

Thanks @rahulishu1993 for your suggestion. I would prefer to learn how to observe the behavior in the container when I invoke docker run -p 4000:80 friendlyhello as it obviously exits quietly. Is there a way invoke this command in a “more verbose” way?

(Monterey) #4

Self provided answer: View logs for a container or service.