aio-libs / aiodocker

Python Docker API client based on asyncio and aiohttp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to custom docker runtime

agusmakmun opened this issue · comments

Long story short

  • Expected behaviour: Should able to set the custom docker runtime.
  • Actual behaviour: Unable to set custom docker runtime.

How to reproduce

First of all, I'm trying to set the custom runtime by using docker itself, and it works as expected.
Then also, previously I tried to use docker.APIClient to set the custom runtime, and it works as expected.
But, now we move into asyncio, so that's why we use this aiodocker, but we have a problem to set the custom runtime.

# 1st terminal
docker --debug info | grep Runtimes
  Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc

docker run -it --runtime=io.containerd.runc.v2 debian

# 2nd terminal
docker ps
docker inspect <container_id>

# find "Runtime", and it set to "io.containerd.runc.v2"

Then using aiodocker:

container_config = {
    "Hostname": "debian-92vwkfdz",
    "Domainname": None,
    "ExposedPorts": {
        "22/tcp": {},
        "80/tcp": {},
        "443/tcp": {},
        "8000/tcp": {},
        "8080/tcp": {},
    },
    "User": None,
    "Tty": True,
    "OpenStdin": True,
    "StdinOnce": False,
    "AttachStdin": False,
    "AttachStdout": False,
    "AttachStderr": False,
    "Env": ["SERVICE_NAME=debian-92vwkfdz", "SERVICE_TAGS=debian"],
    "Cmd": None,
    "Image": "debian",
    "Volumes": None,
    "NetworkDisabled": False,
    "Entrypoint": None,
    "WorkingDir": None,
    "HostConfig": {
        "NetworkMode": "92vwkfdz",
        "PublishAllPorts": True,
        "IpcMode": "private",
    },
    "NetworkingConfig": None,
    "MacAddress": None,
    "Labels": {
        "id": "92vwkfdz",
        "traefik.enable": "true",
        ...
    },
    "StopSignal": None,
    "StopTimeout": None,
    "Runtime": "io.containerd.runc.v2",
}

client = await aiodocker.Docker(url=base_url, connector=connector)
machine = await client.containers.create(
    config=container_config, name="debian"
)

Then, after that some how the "Runtime" unable to set to "io.containerd.runc.v2" when we do inspect to it container.
To note that, previously we able to set the runtime when it docker client is client = docker.APIClient

Your environment

  • macOS Big Sur
  • Python 3.8.14
  • django==3.2.15
  • docker==5.0.3
  • aiodocker==0.21.0