container_create: fix OCI processArgs assemblement

This patch fixes the following command:

kubectl run -i --tty centos --image=centos -- sh

The command above use to fail with:

/usr/bin/sh: /usr/bin/sh: cannot execute binary file

That's because we were wrongly assembling the OCI processArgs.

Thanks @alexlarsson for spotting this.

This patch basically replicates what docker does when merging container
config and image config. It also replicates how docker sets processArgs
for the OCI runtime.

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2017-06-07 18:38:04 +02:00
parent cb4c6004fc
commit 65d4ac8fc2
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9
2 changed files with 35 additions and 51 deletions

View file

@ -666,7 +666,7 @@ function teardown() {
echo "$output"
[ "$status" -eq 0 ]
pod_id="$output"
volumesconfig=$(cat "$TESTDATA"/container_redis.json | python -c 'import json,sys;obj=json.load(sys.stdin);obj["image"]["image"] = "gcr.io/k8s-testimages/redis:e2e"; json.dump(obj, sys.stdout)')
volumesconfig=$(cat "$TESTDATA"/container_redis.json | python -c 'import json,sys;obj=json.load(sys.stdin);obj["image"]["image"] = "gcr.io/k8s-testimages/redis:e2e"; obj["args"] = []; json.dump(obj, sys.stdout)')
echo "$volumesconfig" > "$TESTDIR"/container_config_volumes.json
run crioctl ctr create --config "$TESTDIR"/container_config_volumes.json --pod "$pod_id"
echo "$output"