Skip to main content

Interaction with Containers

1. Start and Leave a Container Running

podman run -dit --name mystay ubuntu:24.04 bash

ℹ️ Use podman run --help to learn the -d flag runs a container in detachted mode.

Check it’s running:

podman ps

2. Exec Into It

podman exec -it mystay bash

Leave it again:

exit

3. Run a Quick Command

podman exec mystay echo "Hello from inside"

4. Determine an EntryPoint

Whenever you run a container, there is some entrypoint that is the entry into the container.

docker image inspect python:3.11 --format='{{.Config.Entrypoint}}'

ℹ️ If it returns [] or null, then the image has no ENTRYPOINT, and Docker will default to the CMD instruction instead. So you can also see what the CMD is for a container

docker image inspect ubuntu:24.04 --format='Entrypoint: {{.Config.Entrypoint}}, Cmd: {{.Config.Cmd}}'

For an image like python-slim:3.11, the entrypoint is python. This can be overridden with --entrypoint. Search for the official python container and find the 3.11-slim tag.

podman run -it --entrypoint /bin/bash python:3.11-slim

:information_source You can set your own entrypoint when you build your container. This can be useful to run an analysis configuration or start a replay.