Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meaning of Docker command

It seems a simple question but it's really not clear what the meaning is of this command:

docker run -d -p 5000:5000 --restart=always --name registry \
  -v `pwd`/certs:/certs \
  -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \
  -e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \
  registry:2

The -v pwd/certs:/certs \is not clear at all. Could someone give an explanation


2 Answers

explanation

`pwd` - shell command to show current path, normally you can replace with $(pwd)

So -v pwd/certs:/certs means, mount the current path's subpath certs to docker container's folder /certs

For each line has backslash \ in the end, is used for long input

like image 143
BMW Avatar answered Mar 02 '26 14:03

BMW


In Docker, images are loaded into the container using 'run' command 'docker run -d -p 5000:5000' this line of command shows the container is going to run as daemon service(-d) means it will start the container in background automatically. -p is assigning ports for your container as BMW says 'pwd' will give the current directory -v will assign our host's folder path to Container's folder path. You are all set for using your Container. Happy Coding!

like image 45
Mohammed Anis Avatar answered Mar 02 '26 15:03

Mohammed Anis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!