docker run

From wikieduonline
Jump to navigation Jump to search

docker run IMAGE|IMAGE_ID

-e (Environment variables)
-d dettach
-v
-p
-w
-u 0
--rm
--name 
--user
--link (deprecated) (See also: Kibana/Install Kibana using docker)
--privileged
--group-add $(getent group docker | cut -d: -f3)

Examples

35a35860802541a4f2267c28f3afd7de175731a2c6c80c84e992ce6062f5a9dd
  • 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
  • docker run -d -it --name devtest --mount type=bind,source="$(pwd)"/target,target=/app nginx:latest


Logstash

  • docker run --rm -it -v ~/pipeline/:/usr/share/logstash/pipeline/ docker.elastic.co/logstash/logstash:7.8.0

OpenShift

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" \ 
   registry.redhat.io/openshift3/ose-ansible:v3.11


docker run wrong_image_name
Unable to find image 'wrong_image_name:latest' locally
docker: Error response from daemon: Get "https://registry-1.docker.io/v2/": context deadline exceeded 
(Client.Timeout exceeded while awaiting headers).
See 'docker run --help'.

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

Related terms

See also

Advertising: