docker-container-run
create and start a new container
TLDR
Run a container
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 network.-w, --workdir dir
Working directory inside container.
SEE ALSO
docker-run(1), docker-container(1)
