Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Newer Docker returns hex ID of container as network ID
Browse files Browse the repository at this point in the history
  • Loading branch information
bboreham committed Jul 31, 2020
1 parent 55bcd2a commit 0a9a9cc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/666_abuse_of_start_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ start_suite "Abuse of 'start' operation"

weave_on $HOST1 launch
docker_bridge_ip=$(weave_on $HOST1 docker-bridge-ip)
proxy_start_container $HOST1 --name=c1
id1=$(proxy_start_container $HOST1 --name=c1)

check_hostconfig() {
docker_on $HOST1 attach $1 >/dev/null 2>&1 || true # Wait for container to exit
Expand All @@ -16,12 +16,12 @@ check_hostconfig() {
# Start c2 with a sneaky HostConfig
proxy docker_on $HOST1 create --name=c2 $SMALL_IMAGE $CHECK_ETHWE_UP
proxy docker_api_on $HOST1 POST /containers/c2/start '{"NetworkMode": "container:c1"}'
check_hostconfig c2 container:c1
check_hostconfig c2 "container:$id1"

# Start c5 with a differently sneaky HostConfig
proxy docker_on $HOST1 create --name=c5 $SMALL_IMAGE $CHECK_ETHWE_UP
proxy docker_api_on $HOST1 POST /containers/c5/start '{"HostConfig": {"NetworkMode": "container:c1"}}'
check_hostconfig c5 container:c1
check_hostconfig c5 "container:$id1"

# Start c3 with HostConfig having empty binds and null dns/networking settings
proxy docker_on $HOST1 create --name=c3 -v /tmp:/hosttmp $SMALL_IMAGE $CHECK_ETHWE_UP
Expand All @@ -41,7 +41,7 @@ assert "docker_on $HOST1 inspect -f '{{.HostConfig.MemorySwap}}' c4b" "-1"
# Start c6 with both named and unnamed HostConfig
proxy docker_on $HOST1 create --name=c6 $SMALL_IMAGE $CHECK_ETHWE_UP
proxy docker_api_on $HOST1 POST /containers/c6/start '{"NetworkMode": "container:c2", "HostConfig": {"NetworkMode": "container:c1"}}'
check_hostconfig c6 container:c1
check_hostconfig c6 "container:$id1"

# Start c7 with an empty HostConfig and check this removes previous parameters, but still attaches to weave
proxy docker_on $HOST1 create --name=c7 --memory-swap -1 $SMALL_IMAGE $CHECK_ETHWE_UP
Expand All @@ -55,9 +55,9 @@ proxy docker_api_on $HOST1 POST /containers/c8/start '{"HostConfig": {"NetworkMo
check_hostconfig c8 host

# Start c10 in network of host container
proxy_start_container $HOST1 --name=c9 --net=host
id9=$(proxy_start_container $HOST1 --name=c9 --net=host)
proxy docker_on $HOST1 create --name=c10 $SMALL_IMAGE $CHECK_ETHWE_MISSING
proxy docker_api_on $HOST1 POST /containers/c10/start '{"HostConfig": {"NetworkMode": "container:c9"}}'
check_hostconfig c10 container:c9
check_hostconfig c10 "container:$id9"

end_suite

0 comments on commit 0a9a9cc

Please sign in to comment.