-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: install recent version of
container-selinux
The default `container-selinux` policies as provided by CentOS (2.74) are not compatible with `containerd`/`runc` (AVC denials when `runc` attempts to `setattr` on `fifo_file` resources, see links below). This PR forces the install of a third-party package (so this introduces some technical debt...), and includes a simple test-script (to be invoked manually) to check `containerd` is working correctly. Fixes: #573 See: containers/podman#1980 See: containers/container-selinux@ae6e25b
- Loading branch information
Showing
2 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/bin/bash | ||
|
||
set -xue -o pipefail | ||
|
||
cat > /etc/cni/net.d/98-containerd-test-bridge.conf << EOF | ||
{ | ||
"cniVersion": "0.3.1", | ||
"name": "bridge", | ||
"type": "bridge", | ||
"bridge": "cnio0", | ||
"isGateway": true, | ||
"ipMasq": true, | ||
"ipam": { | ||
"type": "host-local", | ||
"ranges": [ | ||
[{"subnet": "192.168.123.0/24"}] | ||
], | ||
"routes": [{"dst": "0.0.0.0/0"}] | ||
} | ||
} | ||
EOF | ||
|
||
cat > /etc/cni/net.d/99-containerd-test-loopback.conf << EOF | ||
{ | ||
"cniVersion": "0.3.1", | ||
"type": "loopback" | ||
} | ||
EOF | ||
|
||
systemctl restart containerd | ||
|
||
cat > /tmp/sandbox.json << EOF | ||
{ | ||
"metadata": { | ||
"name": "nginx-sandbox", | ||
"namespace": "default", | ||
"attempt": 1, | ||
"uid": "hdishd83djaidwnduwk28bcsb" | ||
}, | ||
"linux": { | ||
} | ||
} | ||
EOF | ||
cat > /tmp/container.json << EOF | ||
{ | ||
"metadata": { | ||
"name": "busybox" | ||
}, | ||
"image":{ | ||
"image": "busybox" | ||
}, | ||
"command": [ | ||
"top" | ||
], | ||
"linux": { | ||
} | ||
} | ||
EOF | ||
|
||
export CONTAINER_RUNTIME_ENDPOINT=unix:///run/containerd/containerd.sock | ||
|
||
crictl version | ||
|
||
PODID=$(crictl runp /tmp/sandbox.json) | ||
crictl pods | ||
crictl inspectp "${PODID}" | ||
|
||
crictl pull busybox | ||
|
||
CONTAINERID=$(crictl create "${PODID}" /tmp/container.json /tmp/sandbox.json) | ||
|
||
crictl ps -a | ||
crictl start "${CONTAINERID}" | ||
crictl ps | ||
crictl inspect "${CONTAINERID}" | ||
crictl exec -i -t "${CONTAINERID}" ls | ||
crictl exec -i -t "${CONTAINERID}" ps ax | ||
|
||
crictl stats | ||
|
||
crictl stop "${CONTAINERID}" | ||
crictl rm "${CONTAINERID}" | ||
|
||
crictl stopp "${PODID}" | ||
crictl rmp "${PODID}" | ||
|
||
rm -f /etc/cni/net.d/98-containerd-test-bridge.conf | ||
rm -f /etc/cni/net.d/99-containerd-test-loopback.conf | ||
rm -f /tmp/sandbox.json | ||
rm -f /tmp/container.json | ||
|
||
systemctl restart containerd |