<p>So what's the problem?</p>

<blockquote>
  <p>'app.py': [Errno 2] No such file or directory</p>
</blockquote>

<p>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.</p>

<p>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 <code>Dockerfile</code> is built into an image, <code>app.py</code> and <code>requirements.txt</code> is present because of that Dockerfile’s <code>COPY</code> command, and the output from <code>app.py</code> is accessible over HTTP thanks to the <code>EXPOSE</code> command.
<a href="https://docs.docker.com/get-started/part2/#dockerfile" rel="nofollow noreferrer">Get Started, Part 2: Containers</a></p>

CC BY-SA 4.0
2018-11-06T06:14:25.923Z
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
CC BY-SA 4.0
2018-11-06T06:47:48.013Z
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
CC BY-SA 4.0
2018-11-06T07:20:52.887Z
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
CC BY-SA 4.0
2018-11-06T07:31:43.143Z
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
CC BY-SA 4.0
2018-11-06T08:05:05.813Z
Yes, the deployed container works as expected.
Tran Triet
CC BY-SA 4.0
2018-11-06T09:24:09.407Z
put run commands and all outputs of them in the "Prerequisites".and the other from than point on.there must be some clue
hakkican
CC BY-SA 4.0
2018-11-06T04:25:49.637Z
2018-11-07T10:54:20.473Z
2018-11-07T10:54:20.473Z
hakkican
<p>I am learning Docker by following the <a href="https://docs.docker.com/get-started/part3/#run-your-new-load-balanced-app" rel="nofollow noreferrer">get started</a> on its official page.</p>

<p>I got stuck at part 3 when I tried to run </p>

<p><code>docker service ps getstartedlab_web</code></p>

<p>the containers fail to start. Checking the logs reveals this</p>

<p><code>'app.py': [Errno 2] No such file or directory</code></p>

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

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

<p><strong>Update</strong>
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 <code>docker run</code> (without docker-compose). The problem only arises when I tried to use docker-compose to scale it.</p>

<docker><docker-compose>
Error while following Docker get-started part 3
Tran Triet
# Error while following Docker get-started part 3

(Asked by: username_0 on 2018-11-06)

I am learning Docker by following the [get started](https://docs.docker.com/get-started/part3/#run-your-new-load-balanced-app) 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.

**Tags:** docker, docker-compose


---

## 1 answers

### Answer by username_1 on 2018-11-06. Score: 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](https://docs.docker.com/get-started/part2/#dockerfile)

> **Comments:**
> **username_0**: 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.  
> **username_1**: 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"  
> **username_0**: 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.  
> **username_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.  
> **username_0**: Yes, the deployed container works as expected.  
> **username_1**: put run commands and all outputs of them in the "Prerequisites".and the other from than point on.there must be some clue  

---

