I’m porting an application from Ubuntu Host running plain Docker onto a RaspberryPi running the Docker snap. Unfortunately I cannot create a machine required to run the application:
$ docker-compose -f fullstack-rpi.yml up
ERROR: Couldn't connect to Docker daemon - you might need to run `docker-machine start default`.
fkromer@localhost:~/app$ docker-machine start default
Docker machine "default" does not exist. Use "docker-machine ls" to list machines. Use "docker-machine create" to add a new one.
fkromer@localhost:~/app$ docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
fkromer@localhost:~/app$ docker-machine create backend
Running pre-create checks...
Error with pre-create check: "VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path"
There can be found some issues in the machine github repo like this one. However to me it’s not clear yet how to fix that issue for the snap version of docker.
Has anyone an idea why this error is displayed and how to fix it?
On Ubuntu Core you need to run docker
commands as root, try sudo docker-compose -f fullstack-rpi.yml up
Ah, right. Instead of running docker as root I’d prefer to use another user instead. Does the same/equivalent post-installation steps apply as is applicable for non-snapped Docker (Manage Docker as a non-root user) for the snapped Docker version as well? Or do I have to use an Ubuntu Core System user?
Unfortunately there is not currently a way to run docker as non-root on Ubuntu Core. What is your use case for running docker not as root on Ubuntu Core? Is this just for development?
Ok. If I’d port the container based app to LXD according to the asciinema video I should be able to run the containers as non-root. Is that correct? I’ve planned to port the app to a snap but need arguments that my project manager lets me actually do it ![:slight_smile: :slight_smile:](https://forum.snapcraft.io/images/emoji/twitter/slight_smile.png?v=12)
Actually it is more tractable to use lxd as non-root than docker, the issue is that for docker, the docker group is hard-coded into the read-only /etc/group file coming from the base snap, while the lxd group is put into the writable /var/lib/extrausers/group file, and so the extrausers group can be modified to include your user. I unfortunately don’t think there exist any tools that understand extrausers to the extent that you could issue a single command, but it certainly works to edit /var/lib/extrausers/group manually to add your user account to the lxd group and reboot (or whatever trick there is to make new groups get picked up without a reboot) works for me.