HiveBrain v1.2.0
Get Started
← Back to all entries
debugdockerMinor

Error while following Docker get-started part 3

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
errorwhilestarteddockerpartfollowingget

Problem

I am learning Docker by following the get started on its official page.

I got stuck at part 3 when I tried to run

docker service ps getstartedlab_web

the containers fail to start. Checking the logs reveals this

'app.py': [Errno 2] No such file or directory

I saw that this issue has been reported elsewhere and the reason was because of the conflict between the volume in docker-compose.yml and workdir in dockerfile.

But my docker-compose.yml doesn't have that volume property, so what's the problem?

Update
I understand the error message. But I don't know why such an error message was shown. I was able to push/pull and start the container alone with docker run (without docker-compose). The problem only arises when I tried to use docker-compose to scale it.

Solution

So what's the problem?


'app.py': [Errno 2] No such file or directory

I think you already answered your question. The troubleshooting part, you suspect something, but you did not test it to see if it is really what you think.

Create two more files, requirements.txt and app.py, and put them in the same folder with the Dockerfile. This completes our app, which as you can see is quite simple. When the above Dockerfile is built into an image, app.py and requirements.txt is present because of that Dockerfile’s COPY command, and the output from app.py is accessible over HTTP thanks to the EXPOSE command.
Get Started, Part 2: Containers

Context

StackExchange DevOps Q#5339, answer score: 2

Revisions (0)

No revisions yet.