maci0 / docker-systemd-unpriv Goto Github PK
View Code? Open in Web Editor NEWDocker files for an unprivileged systemd container
License: MIT License
Docker files for an unprivileged systemd container
License: MIT License
Hi,
pretty cool to be able to run systemd unprived.
Unfortunately its not applicable on RHEL 6 (which is the default OS of our customers), since there is full cgroup support - but not at /sys/fs/cgroup - and its imho not possible to get them in there.
[root@ip-172-30-0-24 ec2-user]# cat /proc/cgroups
cpuset 1 6 1
ns 0 1 1
cpu 2 6 1
cpuacct 3 6 1
memory 4 6 1
devices 5 6 1
freezer 6 6 1
net_cls 7 2 1
blkio 8 6 1
perf_event 0 1 1
net_prio 0 1 1
[root@ip-172-30-0-24 ec2-user]# docker run maci0/systemd
FATA[0000] Error response from daemon: Cannot start container f54ae9e93b5deca4f44585819e15bc7e2b913be0d9d0dc0e0c1d1b068102b8e0: [8] System error: mkdir /var/lib/docker/devicemapper/mnt/f54ae9e93b5deca4f44585819e15bc7e2b913be0d9d0dc0e0c1d1b068102b8e0/rootfs/sys/fs/cgroup: no such file or directory
Hello. I found this repo via searching. I am experiencing similar problems with lxc (not docker) and was wondering if you had any expertise with lxc configuration. My goal would be to "port" your solution to the container. Thank you for any info can you provide.
I executed the docker exec command that was printed by run.sh:
docker exec -t -i 5fcd37cf1ae5652ff7f1738e0b8b7579558d4471483aad7ba6d839824e05a039 /bin/bash
Now I'm inside the container. ps shows systemd is running as PID 1:
[root@5fcd37cf1ae5 /]# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 40408 2604 ? Ss 13:52 0:00 /usr/lib/systemd/systemd
root 7 0.0 0.0 11780 3056 ? Ss 13:52 0:00 /bin/bash
root 30 0.0 0.0 47432 3428 ? R+ 13:55 0:00 ps aux
But I can't query systemd's status:
[root@5fcd37cf1ae5 /]# systemctl status
Failed to get D-Bus connection: Operation not permitted
hello,
I need run systemd in docker container. I tried this one:
https://github.com/dramaturg/docker-debian-systemd
I build a docker image with systemd to run in it;
when I start docker container from root user, systemd works well,
as you see , the following process starts:
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 May06 ? 00:00:00 /lib/systemd/systemd
daemon 18 1 0 May06 ? 00:00:00 /usr/sbin/atd -f
root 20 1 0 May06 ? 00:00:04 /usr/sbin/rsyslogd -n
message+ 23 1 0 May06 ? 00:00:00 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-acti
root 29 1 0 May06 ? 00:00:00 /usr/sbin/cron -f
root 31 1 0 May06 ? 00:00:00 /lib/systemd/systemd-logind
root 33 1 0 May06 ? 00:00:15 /lib/systemd/systemd-journald
I can use systemctl to start/stop service ;
But ,when I use other user(not root,eg:tiger),I cann't use systemctl or systemctl --user
in the no root environment;
tiger@ddb392be5603:/$ systemctl --user status
Failed to connect to bus: No such file or directory
I think if I want user systemctl --user command,I need start the systemd --user process manually,but also cann't start at tiger user environment:
error is:
tiger@ddb392be5603:/$ /lib/systemd/systemd --user
Failed to create /system.slice/docker.service/init.scope control group: Permission denied
Failed to allocate manager object: Permission denied
please help me ,thanks a lots;
PS:
my dockerfile like this:
...
VOLUME [ "/sys/fs/cgroup", "/run", "/run/lock", "/tmp" ]
CMD ["/lib/systemd/systemd"]
run docker command:
docker run -d -t -i -v /sys/fs/cgroup:/sys/fs/cgroup:ro bashimage_debian_use_systemd:v1.0
OS version:
tiger@ddb392be5603:/$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.4 (jessie)
Release: 8.4
Codename: jessie
my doceker version:
docker --version
Docker version 1.7.0, build 0baf609
Host systemd version:
systemd --version
systemd 215
+PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR
docker container systemd version:
root@ddb392be5603:/# systemd --version
systemd 228
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN
Unfortnately when you start the machine you get a SEGV! Suggestions?
After yum -y install httpd, I ran systemctl start httpd, I got:
[root@b4ae10ee4b25 /]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
Active: failed (Result: exit-code) since Thu 2015-01-22 09:43:54 UTC; 5s ago
Process: 592 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=226/NAMESPACE)
Process: 591 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=226/NAMESPACE)
Main PID: 591 (code=exited, status=226/NAMESPACE)
Jan 22 09:43:54 b4ae10ee4b25 systemd[1]: httpd.service: main process exited, code=exited, status=226/NAMESPACE
Jan 22 09:43:54 b4ae10ee4b25 systemd[1]: httpd.service: control process exited, code=exited status=226
Jan 22 09:43:54 b4ae10ee4b25 systemd[1]: Failed to start The Apache HTTP Server.
Jan 22 09:43:54 b4ae10ee4b25 systemd[1]: Unit httpd.service entered failed state.
Tried under CentOS7 host and Ubuntu 14.04 host.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.