感謝🙏
https://www.hippolab.ru/zapuskaem-systemd-v-docker-konteynere
或許你已經找了許多的文章,有說将
/bin/bash
改成
/sbin/init
的,可是這對archlinux容器來說并不管用。
請用下面的容器腳本啟動(注意這個是類unix下的腳本,windows會報錯找不到路徑)
#/bin/bash
docker run -tid \
--name archlinux \
--entrypoint=/usr/lib/systemd/systemd \
--env container=docker \
--mount type=bind,source=/sys/fs/cgroup,target=/sys/fs/cgroup \
--mount type=bind,source=/sys/fs/fuse,target=/sys/fs/fuse \
--mount type=tmpfs,destination=/tmp \
--mount type=tmpfs,destination=/run \
--mount type=tmpfs,destination=/run/lock \
-p 3333:22 \
archlinux \
--log-level=info --unit=sysinit.target
然後執行腳本就可以了。