docker-container-run
create and start a new container
TLDR
SYNOPSIS
docker container run [options] image [command] [args...]
DESCRIPTION
docker container run creates and starts a new container from a specified image, combining the functionality of docker container create and docker container start into a single command. This is the most common way to launch containers in Docker.When executed, Docker pulls the image if not locally available, creates a container with the specified configuration, and starts it. The command supports extensive configuration options for networking, storage, resource limits, and runtime behavior. Using --rm ensures ephemeral containers are cleaned up automatically, while -d enables daemon mode for background services.This command is equivalent to the legacy docker run command.
PARAMETERS
-d, --detach
Run in background.-i, --interactive
Keep STDIN open.-t, --tty
Allocate pseudo-TTY.-p, --publish hostPort:containerPort
Publish port.-v, --volume src:dest
Bind mount a volume.-e, --env var=value
Set environment variable.--name name
Assign container name.--rm
Remove container on exit.--network network
Connect to the specified network (bridge, host, none, or a user-defined network).-w, --workdir dir
Working directory inside the container.-u, --user user[:group]
Username/UID (and optionally group/GID) to run as.--entrypoint cmd
Override the image's default ENTRYPOINT.--restart policy
Restart policy: no, on-failure[:N], always, or unless-stopped.--pull policy
Pull policy before running: always, missing (default), or never.-m, --memory bytes
Hard memory limit (e.g. 512m, 2g).--cpus n
Number of CPUs the container may use (e.g. 1.5).--hostname name
Hostname assigned inside the container.--privileged
Grant extended privileges to the container.--read-only
Mount the container's root filesystem read-only.--platform os/arch
Set the platform for the image (e.g. linux/amd64).
SEE ALSO
docker-run(1), docker-container(1)
