Closed sanzenwin closed 3 years ago
@sanzenwin, you are making use of a docker image whose process manager is Systemd, so /sbin/init
will always be the first (and only) process that will run during the container initialization. In other words, your instruction /bin/bash -c touch /testfile
won't ever have a chance to execute as it will be passed as parameters to the /sbin/init
command.
You can confirm this point by doing a ps -ef
within your container -- you should see something like this:
admin@117f79d78b75:~$ ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 17:07 ? 00:00:00 /sbin/init --log-level=err /bin/bash -c touch /testfile
root 194 1 0 17:07 ? 00:00:00 /lib/systemd/systemd-journald
root 308 1 0 17:07 ? 00:00:00 /lib/systemd/systemd-udevd
systemd+ 397 1 0 17:07 ? 00:00:00 /lib/systemd/systemd-resolved
root 669 1 0 17:07 ? 00:00:00 /lib/systemd/systemd-logind
Please notice that this is not a Sysbox limitation but just a consequence of how Systemd operates. You have two options at this point:
1) Make use of a docker-image that doesn't rely on Systemd.
or ...
2) Place your init command within a Systemd unit file.
@rodnymolina, I resolved it with the second option which you gave, thank you so much.
cat docker-compose.yml
version: '3.7' services: test-node: container_name: test image: nestybox/ubuntu-bionic-systemd-docker:latest restart: always tty: true stdin_open: true runtime: sysbox-runc command:
cd / && ls -a
on the container: bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var