Created
January 29, 2023 15:56
-
-
Save sshnaidm/7ba488176842d689044108f4b2ed0686 to your computer and use it in GitHub Desktop.
Podman API curl calls
This file contains hidden or 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
# Run API service forever | |
podman system service --time=0 unix:///tmp/podman.sock & | |
##### Containers | |
# Create container | |
curl -XPOST --unix-socket /tmp/podman.sock -H content-type:application/json http://d/v4.0.0/libpod/containers/create -d @cont.conf | |
# cont.conf: | |
{"name": "apicontainer", "image": "alpine", "command": ["sleep", "1h"], "rm": true} | |
# Start container 'apicontainer' | |
curl -XPOST --unix-socket /tmp/podman.sock -H content-type:application/json http://d/v4.0.0/libpod/containers/apicontainer/start | |
# List containers | |
curl -XGET --unix-socket /tmp/podman.sock -H content-type:application/json http://d/v4.0.0/libpod/containers/json | |
# Inspect container 'apicontainer' | |
curl -XGET --unix-socket /tmp/podman.sock -H content-type:application/json http://d/v4.0.0/libpod/containers/vmetrics/json | |
# Delete container 'apicontainer' | |
curl -XDELETE --unix-socket /tmp/podman.sock -H content-type:application/json http://d/v4.0.0/libpod/containers/apicontainer | |
# Force delete 'apicontainer' | |
curl -XDELETE --unix-socket /tmp/podman.sock -H content-type:application/json http://d/v4.0.0/libpod/containers/apicontainer?force=true | |
##### Images | |
# Inspect local image: | |
curl --no-buffer -XGET --unix-socket /tmp/podman.sock http://localhost/images/alpine/json | |
curl --no-buffer -XGET --unix-socket /tmp/podman.sock http://d/v4.0.0/libpod/images/alpine/json | |
# Pull the image: | |
curl -XPOST --unix-socket /tmp/podman.sock -H content-type:application/json http://d/v4.0.0/libpod/images/pull?reference=alpine | |
###### Pods | |
# Create a pod | |
curl -XPOST --unix-socket /tmp/podman.sock -H content-type:application/json http://d/v4.0.0/libpod/pods/create -d @pod.conf | |
# cat pod.conf: | |
{"name": "apipod", "portmappings": [{"container_port": 80, "host_port": 8080}]} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment