Parse slirp4netns net options with compat api

Parse the slirp4netns network options when called via compat api. The
options must be extracted from the NetworkMode string.

Fixes #10110

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
This commit is contained in:
Paul Holzinger
2021-04-23 10:52:52 +02:00
parent 8465626e31
commit ca4f6ec1db
5 changed files with 35 additions and 9 deletions

View File

@ -0,0 +1,5 @@
services:
alpine:
image: alpine
network_mode: "slirp4netns:allow_host_loopback=true"
command: sh -c "echo teststring | nc 10.0.2.2 5001"

View File

@ -0,0 +1,8 @@
# -*- bash -*-
# create tempfile to store nc output
OUTFILE=$(mktemp)
# listen on a port, the container will try to connect to it
nc -l 5001 > $OUTFILE &
nc_pid=$!

View File

@ -0,0 +1,4 @@
# -*- bash -*-
kill $nc_pid &> /dev/null
rm -f $OUTFILE

View File

@ -0,0 +1,6 @@
# -*- bash -*-
output="$(cat $OUTFILE)"
expected="teststring"
is "$output" "$expected" "$testname : nc received teststring"