Skip to content

Instantly share code, notes, and snippets.

@ipmb
Created April 19, 2018 15:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipmb/12c812b40707605f6fef464615568021 to your computer and use it in GitHub Desktop.
Save ipmb/12c812b40707605f6fef464615568021 to your computer and use it in GitHub Desktop.
Running systemd in docker with Ubuntu 18.04

Trying to use kitchen-docker. It works great when passing privileged: true to the driver, but some hosted CI systems won't let you do that for security reasons. After trying a million different incantations, I got very close with:

image: ubuntu:18.04
run_options: --tmpfs=/run --tmpfs=/run/lock -v /sys/fs/cgroup/systemd:/sys/fs/cgroup/systemd --stop-signal=SIGRTMIN+3
run_command: /sbin/init

note: kitchen does some extra things like including -e container=docker

This gets a system that boots and mostly works, but has problems with more advanced systemd directives. I use BindReadOnlyPaths in some units and this seems to fail.

Apr 19 14:54:22 web-kitchen.local systemd[1]: /etc/systemd/system/ll_staging_uwsgi.service:30: Failed to parse system call, ignoring: preadv
Apr 19 14:54:22 web-kitchen.local systemd[1]: /etc/systemd/system/ll_staging_uwsgi.service:30: Failed to parse system call, ignoring: pwrite
Apr 19 14:54:22 web-kitchen.local systemd[1]: /etc/systemd/system/ll_staging_uwsgi.service:30: Failed to parse system call, ignoring: statx
Apr 19 14:54:22 web-kitchen.local systemd[1]: /etc/systemd/system/ll_staging_uwsgi.service:30: Failed to parse system call, ignoring: preadv
Apr 19 14:54:22 web-kitchen.local systemd[1]: /etc/systemd/system/ll_staging_uwsgi.service:30: Failed to parse system call, ignoring: pwrite
Apr 19 14:54:22 web-kitchen.local systemd[1]: /etc/systemd/system/ll_staging_uwsgi.service:30: Failed to parse system call, ignoring: statx
Apr 19 14:54:22 web-kitchen.local systemd[1]: Started /bin/systemctl start ll_staging_uwsgi.service.
Apr 19 14:54:22 web-kitchen.local systemd[1]: /etc/systemd/system/ll_staging_uwsgi.service:30: Failed to parse system call, ignoring: preadv
Apr 19 14:54:22 web-kitchen.local systemd[1]: /etc/systemd/system/ll_staging_uwsgi.service:30: Failed to parse system call, ignoring: pwrite
Apr 19 14:54:22 web-kitchen.local systemd[1]: /etc/systemd/system/ll_staging_uwsgi.service:30: Failed to parse system call, ignoring: statx
Apr 19 14:54:22 web-kitchen.local systemd[1]: Starting ll_staging uWSGI...
Apr 19 14:54:22 web-kitchen.local uwsgi3.6[5340]: realpath() of /etc/uwsgi.ini failed: No such file or directory [core/utils.c line 3643]
Apr 19 14:54:22 web-kitchen.local systemd[1]: ll_staging_uwsgi.service: Main process exited, code=exited, status=1/FAILURE
Apr 19 14:54:22 web-kitchen.local systemd[1]: ll_staging_uwsgi.service: Failed with result 'exit-code'.
Apr 19 14:54:22 web-kitchen.local systemd[1]: Failed to start ll_staging uWSGI.
Apr 19 14:54:22 web-kitchen.local systemd[1]: Started /bin/systemctl stop ll_staging_uwsgi.service.
Apr 19 14:54:22 web-kitchen.local systemd[1]: Stopped ll_staging uWSGI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment