Docker in Docker with sysbox cant find the deamon
Hello,
I have installed coder with docker-compose. Also installed sysbox on the host that coder runs. I am trying to get docker to work inside the docker container but i get
cannot connect to the docker daemon at unix:///var/run/docker.sock. is the docker daemon running?
My dockerfile is the following:
Attached is the main.tf20 Replies
<#1288148601612275774>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Attached is the main.tf.
Also when i run
docker inspect --format='{{.HostConfig.Runtime}}' coder-workspace
i get sysbox-runc
so i guess that part is configured properly.@anubis what's the error?
@Phorcys sorry it seems i pasted the wrong thing. the error is:
cannot connect to the docker daemon at unix:///var/run/docker.sock. is the docker daemon running?
oh okay, so yeah you still have to use start docker manually if you don't have systemd
sudo dockerd
otherwise install systemd
, or just use the coder/enterprise-base
image as your base imageOh my god, never thought about it... I will try when i get in the office. Will update you. Thank you.
Issue got resolved. Thank you @Phorcys
@Phorcys I am trying to use the
codercom/enterprise-base:ubuntu
but i get the same error if i dont start docker manually and when i run systemctl
i get the following error:
I run it with the following command:
sudo docker run --runtime=sysbox-runc -it --privileged codercom/enterprise-base:ubuntu
add dockerd & in terraform config
with log redirection
systemd wont work normally in container
if i run the official sysbox image with systemd and docker (
nestybox/ubuntu-bionic-systemd-docker
) then it works fine (both docker and systemctl but i have to login as a user. If i add the part to add the coder user then it fails.
Also my biggest confusion comes from the documentation that says that you can have systemd in docker but only refers to the Kubernetes deployment. https://coder.com/docs/templates/docker-in-workspaces#systemd-in-dockerDocker in workspaces - Coder Docs
Use Docker inside containerized templates
it will with Sysbox
GitHub
sysbox/docs/quickstart/systemd.md at master · nestybox/sysbox
An open-source, next-generation "runc" that empowers rootless containers to run workloads such as Systemd, Docker, Kubernetes, just like VMs. - nestybox/sysbox
oh yeah? i am using sysbox too, but i am just starting the daemon in the terraform file
see this https://pastebin.com/AwcBiH3L
Pastebin
terraform { required_providers { coder = { source = "coder...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
my Dockerfile
yes i did the same in the end, but cant get systemd to work. when i use the codercom image it doesnt start and if i use the sysbox image i need to use the admin account
i assue u mean u need
sudo
or su root
to use docker
if you check my dockerfile, the coder user is added to the docker group
RUN useradd -G sudo,docker --no-create-home --shell /bin/bash ${USER} \
in this way, you dont need sudo or root to run docker commandsNo, I have the same setup as you do now. That works fine. Docker works as expected. The issue is that systemd wont start and will give an error about the user if i use the codercom image. If i use the sysbox image it works fine but only with the admin:admin user
i don't have an immediate answer as i've never tried it but yeah for now you can just start
dockerd
manually
i'll play around with it to see how we can have systemd-in-docker working with Coderwhats the error if u run systemctl with not admin acc?
useradd --create-home --shell /bin/bash coder && echo "admin:admin" | chpasswd && adduser admin sudo docker
try this in dockerfilethat is the error with the codercom image.
hm, i got this error too
same with sudo
what did u do to make systemctl work with sudo?
i havent managed to get it work. the only case where it works is if you use this image https://github.com/nestybox/dockerfiles/blob/master/ubuntu-bionic-systemd/Dockerfile . The issue is that if i add the part for creating a user (instead of using the default admin:admin) then i get errors again.
GitHub
dockerfiles/ubuntu-bionic-systemd/Dockerfile at master · nestybox/d...
Dockerfiles repository. Contribute to nestybox/dockerfiles development by creating an account on GitHub.