Around Go: containers · 3 MIN READ
Docker and Podman: images are not running containers
Distinguish image, container, host networking and persistent data while comparing local runtimes.
Docker and Podman can build and run OCI-style container images, but their host integration, daemon model, networking and rootless behavior are not identical. An image is an artifact; a container is a running or stopped instance with its own lifecycle.
Read build and run separately
These Podman commands build an image from a trusted project and start one named container. The published port is restricted to the local host in this development example. Docker has similar basic commands, but do not assume every option and host behavior is interchangeable.
podman build -t localhost/go-api:dev .
podman run --rm --name go-api \
-p 127.0.0.1:8080:8080 localhost/go-api:devThe application inside the container must listen on an appropriate container interface, usually :8080, for port forwarding to reach it. Its own localhost is not the host's localhost. --rm removes this disposable container on exit; it does not manage external persistent data.
Inspect rootless runtime and the container VM
Podman info reports the active environment; select only the rootless field when that is what you need. On macOS and Windows, Podman commonly uses a Linux VM. machine list and machine start manage that VM rather than the individual application container.
podman info --format '{{.Host.Security.Rootless}}'
# On macOS/Windows with an existing Podman machine:
podman machine list
# Start the chosen existing machine only if it is stopped:
podman machine startLinux installations may not use a Podman machine at all. Rootless does not mean unlimited host access or identical Docker networking. Inspect the selected connection and VM state before creating or restarting any shared environment.
Inspect logs and stop the intended instance
Run these in a second terminal while the earlier foreground go-api container is running. logs reads its stdout/stderr, ps selects its state and stop requests graceful termination. The earlier --rm option removes the disposable container on exit.
podman ps --filter name=go-api
podman logs --tail 50 go-api
podman stats --no-stream go-api
podman stop --time 15 go-apiUse the exact exercise name so another service is not affected. Persistent data needs a deliberate volume and backup policy; --rm concerns the container instance, not an automatic external-storage lifecycle. The image remains available afterwards.
TAKE THIS WITH YOU
Images, instances, virtual-machine integration and persistent data are different layers. Similar command names do not establish identical runtime behavior.
Check your understanding
Which statement is correct about container localhost?
Go to the source
Progress stays in this browser. No account needed.