docker run

From wikieduonline
Jump to navigation Jump to search

docker run IMAGE|IMAGE_ID

-i, --interactive                    Keep STDIN open even if not attached
-t, --tty                            Allocate a pseudo-TTY
-e (Environment variables)
-d dettach
-u 0
--link (deprecated) (See also: Kibana/Install Kibana using docker)
--group-add $(getent group docker | cut -d: -f3)


  • docker run --name your-container-name
  • docker run

  • docker run -v NEW_VOLUME_NAE:/path/inside/container -it alpine /bin/sh
  • docker run --name zabbix-appliance -p 80:80 -p 10051:10051 -d zabbix/zabbix-appliance:latest
  • docker run -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" opensearchproject/opensearch:1.3.1
  • docker run -d --name=grafana -p 3000:3000 grafana/grafana (Docker-compose.yml (Grafana))
  • docker run -it --name teamcity-server-instance -v /YOUR_FOLDER_TO_DATA:/data/teamcity_server/datadir -v /YOUR_FOLDER_TO_LOGS:/opt/teamcity/logs -p 8111:8111 jetbrains/teamcity-server
  • docker run -p 9000:9000 minio/minio server /data
  • docker run -d --log-driver=journald YOUR_CONTAINER
  • docker run -d -p 8080:8080 nodejs/app:latest
  • docker run --name my-custom-nginx-container -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx[1]
  • docker run --name some-nginx-name -d -p 8080:80 some-content-nginx-image

Windows example:

docker run --hostname=localhost --mac-address=02:42:11:11:00:01 --env=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --restart=no --label='' --label='org.opencontainers.image.version=23.10' --runtime=runc -t -d ubuntu:rolling


  • docker run --rm -it -v ~/pipeline/:/usr/share/logstash/pipeline/


docker run -t -u `id -u` \ 
   -v $HOME/.ssh/id_rsa:/opt/app-root/src/.ssh/id_rsa:Z \ 
   -v $HOME/ansible/hosts:/tmp/inventory:Z \ 
   -e INVENTORY_FILE=/tmp/inventory \ 
   -e PLAYBOOK_FILE=playbooks/prerequisites.yml \ 
   -e OPTS="-v" \

docker run wrong_image_name
Unable to find image 'wrong_image_name:latest' locally
docker: Error response from daemon: Get "": context deadline exceeded 
(Client.Timeout exceeded while awaiting headers).
See 'docker run --help'.
docker run socat
docker: Error response from daemon: pull access denied for socat, repository does not exist or may require 'docker login': denied: requested access to the 
resource is denied.
See 'docker run --help'.

Solution: docker run alpine/socat

docker: unknown server OS: .

Solution: start docker

Runtime constraints on resources[edit]

  • -m --memory=""
  • --oom-kill-disable=false Whether to disable OOM Killer for the container or not.
  • --cpus=0.000

docker run --entrypoint "/bin/ls" debian -al /root
docker run -it --entrypoint /usr/bin/redis-cli example/redis --help

docker run -dit --rm --privileged --name dind docker:dind



  1. Understand the difference between docker start and docker run: See also runC
  2. Understand Start configuration behavior and restart policy

Related terms[edit]

See also[edit]

  • Advertising: