Docker image of vyos-1.3 giving systemd error and not running inside docker

Hi ,
I followed the steps described in vyos-github-page .
I chose vyos:1.3 and
DEBIAN_VERSION=buster

i got the build completed. but when i am running it, i am getting following error:

vyos-build/docker-vyos [current]$* docker run -v /lib/modules:/lib/modules --privileged --name r1 -d vyos:1.3-20210627103452
c252760d9d2280df543f001d2c240c9763a11c7286e3000652f34284b87d95d7
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: “/lib/systemd/systemd”: stat /lib/systemd/systemd: no such file or directory: unknown.
vyos-build/docker-vyos [current*]$

Any suggestion to fix this ?

Greetings tpankaj, hope you’re doing well

Did you try rebuilding completely from scratch without caching and then executing docker run again?

Should look like this:

docker build --no-cache --pull --compress -f Dockerfile -t vyos:1.3-date -u +%Y%m%d%H%M%S --build-arg BUILD_DATE="date -u --rfc-3339=seconds" --build-arg VYOS_VERSION=1.3 --build-arg DEBIAN_VERSION=buster --progress plain …

Hi @m1nus,
Thanks a lot for the reply.

earlier also I had done the clean build (without any cache).
This time also, i am following as per your instruction and made build by below cmd:

vyos-build/docker-vyos [current*]$ docker build --no-cache --pull --compress -f Dock-f Dockerfile -t vyos:1.3-date -u +%Y%m%d%H%M%S --build-arg BUILD_DATE="date -u --rfc-3339=seconds" --build-arg VYOS_VERSION=1.3 --build-arg DEBIAN_VERSION=buster --progress plain …

I am building on WSL-2 linux:vyos-build/docker-vyos [current*]$ uname -a
Linux IN-B999Q13 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

I got following image created:

vyos-build/docker-vyos [current*]$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
vyos 1.3-20210628163659 4d3203ef3fea 26 seconds ago 81.3MB

When I run this again:
vyos-build/docker-vyos [current*]$ docker run -v /lib/modules:/lib/modules --name R1 --privileged -d vyos:1.3-20210628163659

9329cd5e653b93363bd77d84e53337f62d938fdf8b0deb2eb32ee6204d19c533docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: “/lib/systemd/systemd”: stat /lib/systemd/systemd: no such file or directory: unknown.

though the “docker ps” shows that container is created:

vyos-build/docker-vyos [current*]$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES9329cd5e653b vyos:1.3-20210628163659 “/lib/systemd/systemd” 38 seconds ago Created R1

If I restart container again… it throws same error again:

vyos-build/docker-vyos [current*]$ docker restart R10
Error response from daemon: Cannot restart container R10: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: “/lib/systemd/systemd”: stat /lib/systemd/systemd: no such file or directory: unknown

One more update:

when I create DEBIAN_VERSION: jessie and vyos_version: 1.3 , then I do not see this issue as reported above.

container starts fine then.

vyos-build/docker-vyos [current*]$ docker run -v /lib/modules:/lib/modules --name R10 --privileged -d vyos:1.3-20210628165344
6b9aa8789215c9ed21e83548c3f899da9313063902a90a4a4c6b37d4e00bd139

vyos-build/docker-vyos [current*]$ docker container ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6b9aa8789215 vyos:1.3-20210628165344 “/lib/systemd/systemd” 9 seconds ago Up 8 seconds R10

Is something wrong with debain:buster-slim image ?

in case of debian-version: jessie with vyos-version: 1.3 (or even version 1.2)… I see following error:

vyos-build/docker-vyos [current*]$ docker exec -it R10 su vyos
No passwd entry for user 'vyos’

how to resolve it ? any idea, please suggest…

Hi, @tpankaj!
This backport should fix the 1.3 version image: VyOS in Docker: T2640: Fixed builds for equuleus (backported from sagitta) by zdc · Pull Request #174 · vyos/vyos-build · GitHub

The problem exists because of wrong versions of some packages and broken installation as a result. You should see the error message about this on the second build stage and a lot of other errors after. Also as ridiculous small resulting image size.

Hi @zsdc ,
thanks a lot for providing the fix.

I tried the fix and its working fine.

Thanks a lot.