moby--moby/integration/container
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
..
checkpoint_test.go integration/container: add a base test for C/R 2019-02-28 23:04:16 -08:00
container_test.go API: properly handle invalid JSON to return a 400 status 2018-11-06 21:30:44 +01:00
copy_test.go Windows: Start of enabling tests under integration/ 2018-09-26 12:28:22 -07:00
create_test.go Capabilities refactor 2019-01-22 21:50:41 +02:00
daemon_linux_test.go TestDaemonRestartIpcMode: modernize 2019-03-08 10:04:43 -08:00
diff_test.go Integration: use testenv.APIClient() 2019-01-03 11:53:41 +01:00
exec_test.go Integration: use testenv.APIClient() 2019-01-03 11:53:41 +01:00
export_test.go Improve consistency in "skip" 2019-01-07 13:56:46 +01:00
health_test.go Integration: use testenv.APIClient() 2019-01-03 11:53:41 +01:00
inspect_test.go Windows: Start of enabling tests under integration/ 2018-09-26 12:28:22 -07:00
ipcmode_linux_test.go daemon: use 'private' ipc mode by default 2019-03-09 18:57:42 -08:00
kill_test.go integration: add/use WithRestartPolicy 2019-03-08 10:03:55 -08:00
links_linux_test.go Improve consistency in "skip" 2019-01-07 13:56:46 +01:00
logs_test.go Improve consistency in "skip" 2019-01-07 13:56:46 +01:00
main_test.go Add an integration/internal/container helper package 2018-02-10 17:29:38 +01:00
mounts_linux_test.go Simplify skip checks 2019-01-07 13:56:57 +01:00
nat_test.go Improve consistency in "skip" 2019-01-07 13:56:46 +01:00
pause_test.go Integration: use testenv.APIClient() 2019-01-03 11:53:41 +01:00
ps_test.go Integration: use testenv.APIClient() 2019-01-03 11:53:41 +01:00
remove_test.go Improve consistency in "skip" 2019-01-07 13:56:46 +01:00
rename_test.go Improve consistency in "skip" 2019-01-07 13:56:46 +01:00
resize_test.go Integration: use testenv.APIClient() 2019-01-03 11:53:41 +01:00
restart_test.go Test: Replace NewClient() with NewClientT() 2018-12-22 15:53:02 +01:00
run_linux_test.go Integration: use testenv.APIClient() 2019-01-03 11:53:41 +01:00
stats_test.go Integration: use testenv.APIClient() 2019-01-03 11:53:41 +01:00
stop_linux_test.go Fix some minor wording / issues 2019-01-07 13:57:01 +01:00
stop_test.go integration: add/use WithRestartPolicy 2019-03-08 10:03:55 -08:00
stop_windows_test.go Integration: use testenv.APIClient() 2019-01-03 11:53:41 +01:00
update_linux_test.go Fix container update resetting pidslimit on older API clients 2019-02-24 16:32:32 +01:00
update_test.go TestUpdateRestartWithAutoRemove: use WithAutoRemove 2019-03-08 09:59:22 -08:00
wait_test.go migrated container wait integration tests from integration-cli to integration/container package 2018-07-23 17:37:21 -04:00