mirror of
https://github.com/containers/podman.git
synced 2025-12-01 18:49:18 +08:00
[docker compat] Don't overwrite the NetworkMode if containers.conf overrides netns.
Fixes #16915 (only the part about docker client). Signed-off-by: Romain Geissler <romain.geissler@amadeus.com>
This commit is contained in:
@@ -417,6 +417,24 @@ t GET containers/$cid/json 200 \
|
||||
|
||||
t DELETE containers/$cid?v=true 204
|
||||
|
||||
# test create with default netns="host"
|
||||
stop_service
|
||||
CONTAINERS_CONF=$TESTS_DIR/containers.host-netns.conf start_service
|
||||
|
||||
# check that the default docker netns "default" is rewritten to "host"
|
||||
# when the containers.conf explicitly uses "host"
|
||||
t POST containers/create Image=$IMAGE HostConfig='{"NetworkMode":"default"}' 201 \
|
||||
.Id~[0-9a-f]\\{64\\}
|
||||
cid=$(jq -r '.Id' <<<"$output")
|
||||
t GET containers/$cid/json 200 \
|
||||
.HostConfig.NetworkMode="host"
|
||||
|
||||
t DELETE containers/$cid?v=true 204
|
||||
|
||||
# Restart with the default containers.conf for next tests.
|
||||
stop_service
|
||||
start_service
|
||||
|
||||
# Test Compat Create with healthcheck, check default values
|
||||
t POST containers/create Image=$IMAGE Cmd='["top"]' Healthcheck='{"Test":["true"]}' 201 \
|
||||
.Id~[0-9a-f]\\{64\\}
|
||||
|
||||
2
test/apiv2/containers.host-netns.conf
Normal file
2
test/apiv2/containers.host-netns.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
[containers]
|
||||
netns="host"
|
||||
Reference in New Issue
Block a user