Docker with systemctl




Follow these steps:

1. Download systemctl.py from this URL
https://github.com/gdraheim/docker-systemctl-replacement/blob/master/files/docker/systemctl.py

2. Shutdown your container target
$ docker container stop container-id

3. Copy systemctl.py into your target
$ docker cp systemctl.py container-id:/usr/bin/systemctl

4. Start container
$ docker container start container-id

5. Test
$ docker exec container-id systemctl list-units --type=service --state=running

6. If you got message "Permission denied", jump into your container
$ docker exec -u 0 -it container-id bash

7. Execute this command
$ chmod a+x /usr/bin/systemctl

8. Now you can test again
$ systemctl list-units --type=service --state=running
or execute step number 5.

Done.

Source :
https://github.com/gdraheim/docker-systemctl-replacement

Comments