Search code examples
dockerdocker-compose

How to bring up a docker-compose container as privileged?


I was running my container with the command sudo docker run --privileged container_name. But now I'm using a YML and and the command docker-compose up to bring it up but I don't know how to add the --privileged flag when bringing up the container with that command. I already tried adding privileged: true to the YML but it doesn't work in that case.


Solution

  • I solved it myself by doing the following: in the docker-compose.yml file I have these two lines for specifying the image and container's name

    version: "3"
    services:
      app:
        image: my_image
        container_name: my-container
    

    so to run it with the --privileged flag I used the command: sudo docker run --privileged my-container