Search code examples
dockerdocker-composerunccontainerd

Convert docker-compose.yml to runc config.json


I want to convert docker-compose.yml to (a set of) runc config.json.

I found so far:

  • copying config.json from running docker container (is unreliable)
  • somehow using dockerd API to create config.json from Docker Image

None of these handle parsing of the docker-compose.yml into usable runc specification. Does there exist something like this?


Solution

  • I ended up just using a YAML parser to parse the docker-compose.yml. It turns out there are not that many things that a runc config has to get from the docker-compose.yml

    1. read_only
    2. command
    3. working_dir
    4. environment variables
    5. tty
    6. capabilities
    7. memory limits
    8. hostname
    9. cgroup_parent
    10. pid
    11. ipc
    12. volumes

    most of which are not really relevant to most configurations