# \[Docker\] lesson 12 \< section 6 (Running Multi-container Applications) - simple solution

**URL:** <https://forum.codewithmosh.com/t/docker-lesson-12-section-6-running-multi-container-applications-simple-solution/12088>\
**Category:** Docker\
**Created:** [April 24, 2022, 5:25pm UTC](https://forum.codewithmosh.com/t/docker-lesson-12-section-6-running-multi-container-applications-simple-solution/12088 "2022-04-24T17:25:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![1tsg00d](https://avatars.discourse-cdn.com/v4/letter/1/ee59a6/32.png) [@1tsg00d](https://forum.codewithmosh.com/u/1tsg00d)\
**Post date:** [April 24, 2022, 5:25pm UTC](https://forum.codewithmosh.com/t/docker-lesson-12-section-6-running-multi-container-applications-simple-solution/12088/1 "2022-04-24T17:25:04Z")

</div>

I just had to add  
`user: root`  
in the docker-compose.yml file  
It seems like docker-compose.yml file is executing the backend host as the user set in this Dockerfile and by adding user: root it knows to run it like root and not app.  
The good news is that we do not give the permission x to the file as was intended in the first place. Do the docker exec -it … sh to the backend container and see for yourself

```auto
version: "3.8"

services:
  frontend:
    depends_on: 
      - backend
    build: ./frontend
    ports:
      - 3000:3000

  backend: 
    depends_on: 
      - db
    build: ./backend
    user: root
    ports: 
      - 3001:3001
    environment: 
      DB_URL: mongodb://db/vidly
    command: ./docker-entrypoint.sh

  db:
    image: mongo:4.0-xenial
    ports:
      - 27017:27017
    volumes:
      - vidly:/data/db

volumes:
  vidly:

```

---

<div class="post-metadata">

**Author:** ![UniqueNospaceShort](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/uniquenospaceshort/32/1814_2.png) [@UniqueNospaceShort](https://forum.codewithmosh.com/u/UniqueNospaceShort)\
**Post date:** [April 28, 2022, 6:28pm UTC](https://forum.codewithmosh.com/t/docker-lesson-12-section-6-running-multi-container-applications-simple-solution/12088/2 "2022-04-28T18:28:47Z")

</div>

Hi,  
I did not take the course on Docker from Mos so I don’t know the context.  
Reading your post it looks like Mosh is doing an operation to give permission to a (set of) file(s) and you decided to use the root user instead.

That’s not very good news then. The philosophy in Linux is to avoid root at all cost, hence the `chmod +x` kind of operation.

That said, many docker images I used break that rule anyway.

---

<div class="post-metadata">

**Author:** ![1tsg00d](https://avatars.discourse-cdn.com/v4/letter/1/ee59a6/32.png) [@1tsg00d](https://forum.codewithmosh.com/u/1tsg00d)\
**Post date:** [April 30, 2022, 6:50pm UTC](https://forum.codewithmosh.com/t/docker-lesson-12-section-6-running-multi-container-applications-simple-solution/12088/3 "2022-04-30T18:50:13Z")

</div>

You are right. I was not thinking straight.  
I should have done the `whoami` command when doing docker exec -it … sh in backend.  
However, chmod +x didnt work for me the first time around. I was totally stuck. Whats even weirder is that a few days later I dont even need the chmod to put permission x on ‘others’ (and I removed all images and containers and ran --no-cache when building).  
Glad it works but also a bit worried not knowing what caused the error the first time around.
