mviereck / x11docker

Run GUI applications and desktops in docker and podman containers. Focus on security.
MIT License
5.62k stars 378 forks source link

docker-init location under snap install #51

Closed jcalfee closed 6 years ago

jcalfee commented 6 years ago

I just did a snap docker install on Debian 9 .. The docker-init file is here: /snap/docker/179/bin/docker-init

x11docker script does not find it:

$ x11docker
x11docker note: Using X server option --xephyr

x11docker note: Did not find container init system 'tini'.
  This is a bug in your distributions docker package.
  Normally, docker provides init system tini as '/usr/bin/docker-init'.

x11docker uses tini for clean process handling and fast container shutdown.
  To provide tini yourself, please download tini-static:
    https://github.com/krallin/tini/releases/download/v0.18.0/tini-static
  Store it in one of:
    /home/james/.local/share/x11docker/
    /usr/local/share/x11docker/
jcalfee commented 6 years ago

The work-around was to create a symbolic link to docker-init in /home/james/.local/share/x11docker but name the link tini-static.

mviereck commented 6 years ago

Thank you for reporting this!

The work-around was to create a symbolic link to docker-init in /home/james/.local/share/x11docker but name the link tini-static.

That is a good approach in general. Maybe it fails because docker has issues with shared symlinks. I could check with realpath, but I'd prefer a more general solution.

the file it said was missing is docker-init but the file it wants me to download is tini-static

It's a bit confusing - the docker binary is called docker-init, but in fact it is tini-static. If you run docker-init --version it shows tini. tini-static is statically linked especially to be independent from glibc. E.g. alpine images are quite common and use musl libc instead of glibc as a quite basic system library.

It may be the best if I check for /snap/docker/179/bin/docker-init. I am a bit confused about 179. It looks like a random number I cannot rely on. Can you shed some light? I am not familar with snap. Is there a reliable way I can check for docker in snap and the path to docker-init?

jcalfee commented 6 years ago

I'm not sure yet either .. It is my first time using it. I could not find docker on debian using apt.. It was in snap though. Time to learn more about it.. Snap is installable using apt on debian..

mviereck commented 6 years ago

One idea - does which docker-init or command -v docker-init find the right location?

I have hard-coded /usr/bin/docker-init, not nice. I should replace it with $(command -v docker-init)

jcalfee commented 6 years ago

neither work

mviereck commented 6 years ago

179 may be a version hint for docker version 1.17.9. I found that other applications can have a current directory. Can you show me the output of ls -l /snap/docker/*? If there is a more general directory name, even as a symlink, I could use that.

As a workaround I could include something like: find /snap/docker -name docker-init

jcalfee commented 6 years ago

Good idea.. you have "current"

# ls -l /snap/docker/*
lrwxrwxrwx 1 root root   3 Jun 27 17:19 /snap/docker/current -> 179

/snap/docker/179:
total 5
drwxr-xr-x 2 root root 376 Sep 21  2017 bin
-rwxr-xr-x 1 root root 552 Sep 21  2017 command-compose.wrapper
-rwxr-xr-x 1 root root 538 Sep 21  2017 command-dockerd.wrapper
-rwxr-xr-x 1 root root 544 Sep 21  2017 command-docker.wrapper
-rwxr-xr-x 1 root root 527 Sep 21  2017 command-help.wrapper
-rwxr-xr-x 1 root root 552 Sep 21  2017 command-machine.wrapper
drwxr-xr-x 4 root root  86 Sep 21  2017 etc
drwxr-xr-x 4 root root  56 Sep 21  2017 lib
drwxr-xr-x 3 root root  43 Sep 21  2017 meta
drwxr-xr-x 2 root root 126 Sep 21  2017 sbin
drwxr-xr-x 3 root root  30 Sep 21  2017 snap
drwxr-xr-x 6 root root  86 May 19  2017 usr
mviereck commented 6 years ago

I have uploaded an update to master that looks for /snap/docker/current/bin/docker-init and resolves the symlink. Due to symlink resolving your first try with a symlink in /home/james/.local/share/x11docker should work now, too. Can you please run x11docker --update-master and try out?

jcalfee commented 6 years ago

works fine .. thank you

eine commented 6 years ago

@jcalfee although you already had it solved in a different way, I suggest you use https://docs.docker.com/install/linux/docker-ce/debian/#prerequisites in the future if you want to get latest updates from docker in a "more traditional" way. See https://askubuntu.com/questions/906289/docker-ce-or-docker-io-package

jcalfee commented 6 years ago

Thanks .. Do you know how I might check up on the docker release to make sure it does not require binary blobs or require close-source tools (like a compiler) to build it?

eine commented 6 years ago

AFAIK all the docker-ce builds for linux hosts are open-source and free, but I am not sure about binaries being free software. Most, if not all, of it should be built on top of repos corresponding to the Moby project, only the CLI being Docker-specific. Closed source parts might be found in the docker-ee version and/or in the builds for either windows or macos. Also, the hub is not open-source. See https://opensource.stackexchange.com/questions/5436/is-docker-still-free-and-open-source and https://news.ycombinator.com/item?id=14156954.

Furthermore, Docker and Moby are entirely written in golang, so no closed-source tools should be required. However, being sincere, I don't know how can you check/proof it, should you need to do so.

I suggest you have a look at https://github.com/docker/docker-ce/ and maybe open an issue at https://github.com/docker/for-linux. If you do it, please link back here. I'd be really glad to know if there is any real difference in how docker.io and docker-ce packages are built for Debian. Should it be equivalent, I assume that Debian filters are fair enough in the sense you point.

mviereck commented 6 years ago

debian provides package docker.io in jessie-backports and in debian 10/buster/testing. But the package was not included in debian 9/stretch/stable.

I don't know for which reasons docker was not included in stretch-stable. Maybe there has been security issues during the freeze phase before stretch-testing became stretch-stable.

At least there seems to be no general preconceiving to provide docker as a debian package due to debian guidelines of open and free software.

Only since about a week docker.io is part of buster/testing as can be seen in the developer informations. Maybe it will find its way into stretch-backports soon.

mviereck commented 6 years ago

I'd be really glad to know if there is any real difference in how docker.io and docker-ce packages are built for Debian.

Here is a list of patches made by debian maintainers: https://sources.debian.org/patches/docker.io/18.03.1+dfsg1-4/

I don't understand all of them, but they are few and look rather harmless.