Skip to content

Instantly share code, notes, and snippets.

@dims
Last active May 10, 2025 14:55
Show Gist options
  • Save dims/936f5ddd85e94ea588781f1570860c2d to your computer and use it in GitHub Desktop.
Save dims/936f5ddd85e94ea588781f1570860c2d to your computer and use it in GitHub Desktop.
#!/bin/bash
cat > ubuntu-pod.json <<EOF
{
"metadata": {
"name": "ubuntu-sandbox",
"namespace": "default",
"attempt": 1,
"uid": "ubuntu-pod-uid"
},
"logDirectory": "/tmp",
"linux": {}
}
EOF
cat > ubuntu-container.json <<EOF
{
"metadata": {
"name": "ubuntu-container"
},
"image": {
"image": "ubuntu:latest"
},
"command": [
"sleep",
"infinity"
],
"log_path": "ubuntu-container.log",
"linux": {}
}
EOF
POD_ID=$(crictl runp ubuntu-pod.json)
CONTAINER_ID=$(crictl create $POD_ID ubuntu-container.json ubuntu-pod.json)
crictl start $CONTAINER_ID
crictl images
crictl pods
crictl ps
crictl exec $CONTAINER_ID ls /
crictl stopp $POD_ID
crictl rmp $POD_ID
crictl pods
crictl ps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment