3

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 Answers2

3

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

BMW
  • 42,880
  • 12
  • 99
  • 116
  • So acutally this is including my certificate in the docker container? –  Dec 15 '15 at 11:15
  • 1
    yes, so your current folder has the `certs` folder? It will be mounted to docker container as `/certs` – BMW Dec 15 '15 at 11:16
3

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!

Mohammed Anis
  • 221
  • 1
  • 6