Difference between revisions of "Docker run"

From wikieduonline
Jump to navigation Jump to search
Line 18: Line 18:
 
* <code>docker run -p [[9000]]:9000 [[minio]]/minio server /data</code>
 
* <code>docker run -p [[9000]]:9000 [[minio]]/minio server /data</code>
 
* <code>[[docker run]] -d --[[log-driver]]=[[journald]] YOUR_CONTAINER</code>
 
* <code>[[docker run]] -d --[[log-driver]]=[[journald]] YOUR_CONTAINER</code>
* docker run --name my-custom-nginx-container -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx<ref>https://hub.docker.com/_/nginx</ref>
+
* <code>docker run --name my-custom-nginx-container -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx</code><ref>https://hub.docker.com/_/nginx</ref>
  
 
== Runtime constraints on resources ==
 
== Runtime constraints on resources ==

Revision as of 05:52, 1 July 2020

docker run[1] IMAGE|IMAGE_ID

-e (Environment variables)
-d detach
-v
-p
--name 
--user
--link (deprecated) (See also: Kibana/Install Kibana using docker)

Examples

  • docker run alpine
  • docker run -it alpine /bin/sh
  • 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 -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 -d --name=grafana -p 3000:3000 grafana/grafana (Docker-compose.yml (Grafana))
  • docker run -p 9000:9000 minio/minio server /data
  • docker run -d --log-driver=journald YOUR_CONTAINER
  • docker run --name my-custom-nginx-container -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -d nginx[2]

Runtime constraints on resources

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


https://medium.com/@oprearocks/how-to-properly-override-the-entrypoint-using-docker-run-2e081e5feb9d

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

Activities

  1. Understand the difference between docker start and docker run: https://stackoverflow.com/questions/34782678/difference-between-running-and-starting-a-docker-container. See also runC
  2. Understand Start configuration behavior and restart policy


Related terms

See also

  • https://docs.docker.com/engine/reference/run/
  • https://hub.docker.com/_/nginx
  • Advertising: