Motivation
Running DDEV for a diverse team of developers (front-end / back-end) on various operating systems (Windows, MacOS and Linux) can become time-consuming, even frustrating at times.
Hoping to simplify the initial setup, I started working on an automated VS Code Remote Container setup.
I want to run DDEV in a VS Code Remote Container.
To complicate things, the container should reside on a remote host.
This is the current state of the setup: caillou/vs-code-ddev-remote-container#9ea3066
Steps Taken
I took the following steps:
- Set up VS Code to talk to a remote Docker installation over
ssh
. You just need to add the following to VS Code'ssettings.json
:"docker.host": "ssh://username@host"
. - Install
Docker
and create a user withUID 1000
on said host. - Add
docker-cli
,docker-compose
, and andddev
to theDockerfile
, c.f. Dockerfile#L18-L20. - Mount the Docker socket in the container and use the remote user with
UID 1000
. In the example, this user is callednode
: devcontainer.json
What Works
Once I launch the VS Code Remote Container extension, an image is build using the Dockerfile
, and a container is run using the parameters defined in the devcontainer.json
.
I can open a terminal window and run sudo docker ps
. This lists the container I am in, and its siblings.
My Problem
- DDEV needs to create docker containers.
- DDEV can not be run as root.
- On the host, the user with
UID 1000
has the privilege to run Docker. - Within the container, the user with
UID 1000
does not have the privilege to run Docker.
The Question
Is there a way to give an unprivileged user access to Docker within Docker?