Docker commands
RunPod enables bring-your-own-container (BYOC) development. If you choose this workflow, you will be using Docker commands to build, run, and manage your containers.
For a Dockerless workflow, see RunPod projects.
The following is a reference sheet to some of the most commonly used Docker commands.
Login
Log in to a registry (like Docker Hub) from the CLI. This saves credentials locally.
Images
docker push
- Uploads a container image to a registry like Docker Hub. docker pull
- Downloads container images from a registry like Docker Hub. docker images
- Lists container images that have been downloaded locally. docker rmi
- Deletes/removes a Docker container image from the machine.
Containers
docker run
- Launches a new container from a Docker image. docker ps
- Prints out a list of containers currently running. docker logs
- Shows stdout/stderr logs for a specific container. docker stop/rm
- Stops or totally removes a running container.
Dockerfile
docker build
- Builds a Docker image by reading build instructions from a Dockerfile.
For the purposes of using Docker with RunPod, you should ensure your build command uses the --platform=linux/amd64
flag to build for the correct architecture.
Volumes
When working with a Docker and RunPod, see how to attach a Network Volume.
docker volume create
- Creates a persisted and managed volume that can outlive containers. docker run -v
- Mounts a volume into a specific container to allow persisting data past container lifecycle.
Network
docker network create
- Creates a custom virtual network for containers to communicate over. docker run --network=<name>
- Connects a running container to a Docker user-defined network.
Execute
docker exec
- Execute a command in an already running container. Useful for debugging/inspecting containers: