Test V2 – GNS3 + Docker On Fedora 33

On Fedora Beta 33 please !

Let’s start by trying to use Podman. First, I created a Podman socket using systemd and then I asked the GNS3 Docker to connect me to this socket. Obviously I asked Podman to daemonize the socket.

By doing so, Docker is able to talk more or less with Podman but not GNS3 ! After a quick look at gns3-server’s code, I saw that the Docker socket is hardcoded to /var/run/docker.sock.

Haha, I can change that, a little sed will do the job.

$ sudo systemctl start podman
$ sudo systemctl status podman
● podman.service - Podman API Service
     Loaded: loaded (/usr/lib/systemd/system/podman.service; static)
     Active: active (running) since Mon 2020-10-26 13:31:22 GMT; 5s ago
TriggeredBy: ● podman.socket
       Docs: man:podman-system-service(1)
   Main PID: 11154 (podman)
      Tasks: 9 (limit: 2326)
     Memory: 80.6M
        CPU: 227ms
     CGroup: /system.slice/podman.service
             └─11154 /usr/bin/podman system service

$ cd /usr/lib/systemd/system
$ cat podman.socket 
[Unit]
Description=Podman API Socket
Documentation=man:podman-system-service(1)
[Socket]
ListenStream=%t/podman/podman.sock
SocketMode=0660
[Install]
WantedBy=sockets.target

$ ls -l /var/run/podman/podman.sock 
srw-rw----. 1 root root 0 26 oct.  13:31 /var/run/podman/podman.sock

# sed -i "s\/var/run/docker.sock\/var/run/podman/podman.sock\g" $(ls -d /usr/lib/python*)/site-packages/gns3server/compute/docker/__init__.py

Argh, in fact, it seemed that the two APIs (Docker and Podman) don’t speak the same language (Podman API is retro compatible). I read in a Medium post that one is in REST and the other is not (?!?). Anyway, I tried to put the podman socket on /var/run/docker.sock but no result either.

There is a pseudo solution using moby-engine (docker rootfull). The only problem is that it works with old cgroups, so I kindly asked the kernel to work with cgroups v1.

sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo reboot

Then we install the docker service, on fedora, it’s moby-engine.

sudo dnf install moby-engine

We add ourselves and we give ourselves the rights.

sudo systemctl enable --now docker
sudo usermod -aG docker username
sudo usermod -aG docker gns3 #not usefull but it help remember

Then the images can be added either in the docker interface or in GNS3 (see below).

and you can see that the two are interfaced.

Voila, we added Docker on GNS3 on Fedora 33.

Mmmmmh… Docker, it’s still cool, it’s not really Podman… It would be good enough to recode the API but I have neither the time nor the skills, so we’ll leave it at that ^^

P.S: you can make GNS3’s Docker connect to the Podman socket by changing the connection port from 80 to 8080 in the $(ls -d /usr/lib/python*)/site-packages/gns3server/compute/docker/docker_vm.py line 74 but this is not enough to launch a container. GNS3 finds the Podman containers and adds them but won’t launch them.
Apparently it would be necessary to add -userns=keep-id to the docker run command. As soon as I find out where to do this in the gns3server code, I’ll write another post, but just for fun, because, rootless Podman doesn’t support networks and all containers will have the same IP, which is not very useful in GNS3… <- epic lose