Home > Software > How to Fix “docker container run” requires at least 1 argument

How to Fix “docker container run” requires at least 1 argument

Anastasios Antoniadis

Troubleshoot the ‘docker container run requires at least 1 argument’ error with our step-by-step guide. Learn how to correctly use the ‘docker container run’ command, including specifying required arguments and options for efficient Docker container management.

Docker (1)

The docker container run command is a fundamental Docker command used to create and start a container from a specified image. When you see the message "docker container run" requires at least 1 argument, it means that you haven’t provided the necessary information Docker needs to execute the command, specifically, the name or ID of the Docker image you want to use for the container.

docker container run: Basic Syntax

The basic syntax for the docker container run command is as follows:

docker container run [OPTIONS] IMAGE [COMMAND] [ARG...]
  • [OPTIONS]: These are optional flags you can set to modify the behavior of the Docker container. Examples include -d for detached mode, --name to specify a custom name for the container, -p to map a port from the container to the host, and many others.
  • IMAGE: This is the required argument that specifies which image Docker should use to create the container. It can be an image from your local Docker image repository or from an online registry like Docker Hub.
  • [COMMAND] [ARG…]: Optionally, you can specify a command to run inside the container when it starts, followed by any arguments for that command. If not provided, Docker will use the default command specified in the image’s Dockerfile.


Here are some examples of how to use the docker container run command:

Running a Container Interactively

docker container run -it ubuntu /bin/bash

This command runs an Ubuntu container and opens an interactive bash shell inside it. The -it option combines -i (interactive) and -t (allocate a pseudo-TTY), which is necessary for interacting with the command line inside the container.

Running a Container in Detached Mode

docker container run -d -p 80:80 nginx

This command runs an Nginx container in detached mode (-d) and maps port 80 on the host to port 80 in the container, allowing you to access the Nginx server via the host’s IP address or domain.

Naming a Container

docker container run --name myredis -d redis

This command runs a Redis container in detached mode and names it myredis. Naming containers is useful for easily referencing them later with other Docker commands.

Running a Container with Environment Variables

docker container run -e MY_VAR=myvalue -d myimage

This command runs a container from the myimage image, setting an environment variable MY_VAR with the value myvalue inside the container. Environment variables are often used for configuration purposes.


The docker container run command is powerful and versatile, allowing you to start containers in various configurations with just a single line in the terminal. Remembering to include at least the required image argument will help you avoid the error and successfully launch your containers as needed.

Anastasios Antoniadis
Follow me
0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x