3

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.

1 Answer 1

2

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

6
  • I understand the problem. But I don't know why that message shows because I followed all the steps. I was able to start that container alone (pushing it up to Docker registry and pulling it down and then docker run it). But the problem is when I run them with docker-compose.
    – Tran Triet
    Nov 6, 2018 at 6:14
  • I paste the link. Did you check that? "Create two more files, requirements.txt and app.py, and put them in the same folder with the Dockerfile"
    – hakkican
    Nov 6, 2018 at 6:47
  • Yes I did make those two files as instructed in the part 2. It works when I run it alone. The problem only arises when I use it with docker compose.
    – Tran Triet
    Nov 6, 2018 at 7:20
  • 1
    everything is ok with "Prerequisites" step3? e.g: last "Be sure your image works as a deployed container" step2 is one container step3 multiple containers.
    – hakkican
    Nov 6, 2018 at 7:31
  • 1
    put run commands and all outputs of them in the "Prerequisites".and the other from than point on.there must be some clue
    – hakkican
    Nov 6, 2018 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.