Specify "privileged" container mode in dockerfile?

11,967

You can't give privileged mode in Dockerfile. You can only run by --privileged when start docker by command line. There is one other way, that you can try start you docker container via Docker API

And set request param for auto run with privileged mode.

As I know, normal case you need to run docker in privileged mode is you wanna run docker in docker. What BIRD container is ?

Share:
11,967

Related videos on Youtube

A. Smith
Author by

A. Smith

Updated on June 04, 2022

Comments

  • A. Smith
    A. Smith almost 2 years

    I am a little new to Docker technology, however, I would like to deploy a couple of BGP BIRD containers throughout my infrastructure. I would like to automate container creation with Dockerfile builds, however, I can not run BIRD in docker without giving the container "privileged" mode. There doesn't appear to be a Dockerfile version for getting "privileged" mode. Are there workarounds or perhaps I am missing the point?

  • A. Smith
    A. Smith over 5 years
    I would love to not use "privileged" mode, but BIRD software requires it and will not run without it. BIRD is used for BGP routing and is quite popular between network administrators. Here is a sample project on github by someone using BIRD: github.com/globocom/bird-routing
  • Truong Dang
    Truong Dang over 5 years
    @A.Smith And you can't start container by you hand, it must be automatic ? In this case, I think create a tool start container by call Docker APi is possible
  • A. Smith
    A. Smith over 5 years
    Yes I can, but then I have to involve bash scripts for my automation + i'd like to deploy other non BIRD containers using the same Dockerfile.
  • Truong Dang
    Truong Dang over 5 years
    You can call Docker API with curl. I think you can add that curl command in your bash script file..
  • A. Smith
    A. Smith over 5 years
    Could you give me a sample of that? For example, if I wanted to build ubuntu container with "privileged status.
  • Truong Dang
    Truong Dang over 5 years
    @A.Smith here you can find example that how you can call docker api to creat container with curl docs.docker.com/develop/sdk/examples
  • Truong Dang
    Truong Dang over 5 years
    And here is params that you can set to curl command. Notice to HostConfig for set Privileged is true
  • Truong Dang
    Truong Dang over 5 years