Running docker server inside azk
Opened this issue · 1 comments
mauricioklein commented
Is is possible to run (or access) a Docker server inside Azk?
My project require some specific containers to be started on runtime, but running inside Docker it seems that Docker server isn't accessible there.
Thanks in advance!
nuxlli commented
@mauricioklein now you can do this in two ways:
1 - dind mode: running a docker server inside a docker container (aka docker-in-docker):
// Azkfile.js
systems({
dind: {
image: "docker:1.9-dind",
mounts: {
"/var/lib/docker": persistent("dind-volumes"),
},
docker_extra: {
HostConfig: { Privileged: true },
},
ports: {
docker: "2375/tcp",
},
export_envs: {
DOCKER_HOST: "tcp://#{net.host}:#{net.port.docker}"
}
},
'dind-client': {
depends: ["dind"],
image: "docker:1.9",
},
});
Now you can run:
$ azk start dind
$ azk shell dind-client
2 - socket mode: mount the docker socket host in a docker container and connect to it (requires integration of this PR #549):
// Azkfile.js
systems({
docker: {
image: "docker:1.9",
mounts: {
"/var/run/docker.sock": path("/var/run/docker.sock", { resolve: false }),
}
}
});
Now you can run:
$ azk shell docker
More info about this images: https://hub.docker.com/r/library/docker/