Skip to content
This repository has been archived by the owner on Jan 1, 2021. It is now read-only.

How to enable systemd for a container? #588

Closed
ghost opened this issue Oct 22, 2014 · 13 comments
Closed

How to enable systemd for a container? #588

ghost opened this issue Oct 22, 2014 · 13 comments

Comments

@ghost
Copy link

ghost commented Oct 22, 2014

I am running boot2docker on OSX 10.10

I'd like to be able to use systemd inside a container, specifically to enable ssh daemon service.
I did the following:

docker run --rm -i -t --privileged=true -v /sys/fs/cgroup:/sys/fs/cgroup:robase/archlinux-systemd /bin/bash

[root@e6ba4b1d5f47 /]# systemctl enable sshd.service
Operation failed: No such file or directory

Any help is appreciated, I've been at this for long now :(

@daghack
Copy link
Contributor

daghack commented Oct 23, 2014

The easy answer to this is you shouldn't need the ssh daemon to be running inside the container. That being said, this isn't an issue with boot2docker, but rather an issue with how you're trying to use Docker itself. As such, I'm referring you to the Docker IRC channel and closing this issue.

@daghack daghack closed this as completed Oct 23, 2014
@ghost
Copy link
Author

ghost commented Oct 23, 2014

Ok I agree about this issue not belonging to boot2docker but why shouldn't one need to run ssh daemon inside a container?

@yosifkit
Copy link
Contributor

The docker way is to run a single process in a container, but if you need to get into the container (say with bash to check config) then docker exec is what you want rather than dealing with something like supervisord or systemd on top of ssh and its keys.

@ghost
Copy link
Author

ghost commented Oct 23, 2014

What about in a scenario where you want to access graphical applications from a docker container? you'd need sshd to be running to connect via ssh -X from host, right?

@yosifkit
Copy link
Contributor

Not necessarily, you should be able to achieve it all with mounts and DISPLAY. Like the example for gparted in docker iteself: Dockerfile.

@tianon
Copy link
Contributor

tianon commented Oct 23, 2014

You're also the creator of moby/moby#8710 upstream, where @jfrazelle is very interested in making this work without extra hacks like running SSH in the container. 😄

@ghost
Copy link
Author

ghost commented Oct 23, 2014

@tianon yes, i got GUI applications to run by running sshd inside a container, forwarding ports in virtualbox and then ssh -X to container to run the application. I hope @jfrazelle can come up with a way for this!

@ghost
Copy link
Author

ghost commented Oct 23, 2014

@yosifkit have you used -e DISPLAY=unix$DISPLAY on OSX?
Also thank you for the link about docker exec, i know better now!

@yosifkit
Copy link
Contributor

I don't have access to an OSX machine, so no. Yeah, docker exec is just barely released in Docker 1.3.0.

@jessfraz
Copy link
Contributor

yes! i definitely want to it's unfortunate I nuked my mac partition completely the other day, think i might have to bring it back for this

@tianon
Copy link
Contributor

tianon commented Oct 23, 2014

You could always install Mac OS to a USB stick or something... ;)

@jessfraz
Copy link
Contributor

lol omg i want to do that just to laugh at the fact im booting mac on a usb stick on MY mac

@SvenDowideit
Copy link
Contributor

@jfrazelle just remember to get a USB3 stick - makes a heck of a difference :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants