1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/integration
Kir Kolyshkin 596ca142e0 daemon: use 'private' ipc mode by default
This changes the default ipc mode of daemon/engine to be private,
meaning the containers will not have their /dev/shm bind-mounted
from the host by default. The benefits of doing this are:

 1. No leaked mounts. Eliminate a possibility to leak mounts into
    other namespaces (and therefore unfortunate errors like "Unable to
    remove filesystem for <ID>: remove /var/lib/docker/containers/<ID>/shm:
    device or resource busy").

 2. Working checkpoint/restore. Make `docker checkpoint`
    not lose the contents of `/dev/shm`, but save it to
    the dump, and be restored back upon `docker start --checkpoint`
    (currently it is lost -- while CRIU handles tmpfs mounts,
    the "shareable" mount is seen as external to container,
    and thus rightfully ignored).

3. Better security. Currently any container is opened to share
   its /dev/shm with any other container.

Obviously, this change will break the following usage scenario:

 $ docker run -d --name donor busybox top
 $ docker run --rm -it --ipc container:donor busybox sh
 Error response from daemon: linux spec namespaces: can't join IPC
 of container <ID>: non-shareable IPC (hint: use IpcMode:shareable
 for the donor container)

The soution, as hinted by the (amended) error message, is to
explicitly enable donor sharing by using --ipc shareable:

 $ docker run -d --name donor --ipc shareable busybox top

Compatibility notes:

1. This only applies to containers created _after_ this change.
   Existing containers are not affected and will work fine
   as their ipc mode is stored in HostConfig.

2. Old backward compatible behavior ("shareable" containers
   by default) can be enabled by either using
   `--default-ipc-mode shareable` daemon command line option,
   or by adding a `"default-ipc-mode": "shareable"`
   line in `/etc/docker/daemon.json` configuration file.

3. If an older client (API < 1.40) is used, a "shareable" container
   is created. A test to check that is added.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-03-09 18:57:42 -08:00
..
build Testing: create new daemon (only) if needed 2019-02-23 13:32:59 +01:00
config Replace waitAndAssert in config_test.go with poll.WaitOn 2019-01-15 03:54:52 +00:00
container daemon: use 'private' ipc mode by default 2019-03-09 18:57:42 -08:00
image Replace t.Fatal(err) with assert.NilError(err) 2019-01-13 21:36:25 +00:00
internal integration: add/use WithRestartPolicy 2019-03-08 10:03:55 -08:00
network Completely remove d.NewClient from testing tools 2019-02-07 16:07:02 -08:00
plugin Use assert.NilError() instead of assert.Assert() 2019-01-21 13:16:02 +01:00
secret Fatalf -> Fatal 2019-01-27 00:43:24 +00:00
service Completely remove d.NewClient from testing tools 2019-02-07 16:07:02 -08:00
session Testing: create new daemon (only) if needed 2019-02-23 13:32:59 +01:00
system Remove Schema1 integration test suite 2019-03-02 10:46:37 -08:00
testdata/https integration/plugin/authz: port tests from integration-cli 2017-10-02 14:20:59 +01:00
volume Run volume-tests again remote daemons as well 2019-01-10 10:18:22 +01:00
doc.go Add canonical import comment 2018-02-05 16:51:57 -05:00