sysbox icon indicating copy to clipboard operation
sysbox copied to clipboard

Is that a right way that use docker entrypoint to excute .sh file and put process /sbin/init into the CMD ?

Open XiaotongZhao opened this issue 3 years ago • 4 comments

Hi, it's me again, I have a question about process /sbin/init in docker, here is my dockerfile : Dockfile and my script.sh file: script.sh and my docker-compose.yml: docker-compose.yml

base on these file I build a image and named "base", and excecute cmd docker-compose up and the log information like this :

image

image

you see the output log information stuck the message "Finished Update UTMP about System Runlevel Changes.", whereas I can still use ssh to visit the container , and so far everything is fine inside the container : image

I worry about the situation that systemd log information stuck , here is my question:

  1. Is there something wrong I don't know? if exist please tell me.
  2. Is a right way that use docker entrypoint to excute script and put process /sbin/init into the CMD ?

thanks, Xiaotong.Zhao

XiaotongZhao avatar Jun 03 '22 03:06 XiaotongZhao

Hi @XiaotongZhao, thanks again for using Sysbox.

I don't think it's working properly, as we would expect systemd to initialize. I suspect the problem is the way the CMD and ENTRYPOINT instructions are set up in the Dockerfile.

Question: what happens if you use only the ENTRYPOINT and remove the CMD instruction?

ENTRYPOINT [ "/sbin/init"]

ctalledo avatar Jun 03 '22 04:06 ctalledo

Hi @ctalledo, thanks for your reply so fast,

Considering your question,I removed the CMD and change dockerfile like this: image

the log information like this: image

as you see, the log information output successful, compare to log information before, it's just a little difference

XiaotongZhao avatar Jun 03 '22 05:06 XiaotongZhao

Thanks @XiaotongZhao.

as you see, the log information output successful, compare to log information before, it's just a little difference

Did systemd reach the login prompt? It seems it got stuck too, but just a little bit later.

ctalledo avatar Jun 03 '22 16:06 ctalledo

Hi, @ctalledo

If I use docker-compose to run container, it wouldn't reach the login prompt, but if I run container base on the command like this :

docker run --runtime=sysbox-runc -it --rm -P --name=test --hostname=syscont base it would reach login prompt, like this:

1

2

Thanks, Xiaotong.Zhao

XiaotongZhao avatar Jun 05 '22 06:06 XiaotongZhao