I am new to Docker. I am trying to follow the Docker Service In Depth. In order for me to create a swarm I have been using DinD, by doing the following.
docker run -d --privileged --name manager --hostname manager docker:dind
docker run -d --privileged --name worker1 --hostname worker1 docker:dind
docker exec manager docker swarm init --advertise-addr $MANAGER_IP
I then get the token and join the worker to the swarm
docker exec worker1 docker swarm join --token $SWARM_TOKEN “$($MANAGER_IP):2377”
I am stuck on the part where I try docker service create. This is what I tried.
-
Get inside my manager container
docker exec -it manager sh -
Once inside the container
docker login -u <your_username> -
After logging in I try to pull down tomcat, so I can then use the docker service create command but I get this. I removed the PAT part of the url.
failed to copy: httpReadSeeker: failed open: failed to do request: Get “https://production.cloudfront.docker.com/registry-v2/docker/registry/v2/blobs/”: tls: failed to verify certificate: x509: certificate signed by unknown authority
UPDATE: I created a local registry and pushed tomcat to that. Outside of the container I can run it without a problem. But when I try the following, inside the container, I get the error below.
docker pull localhost:5000/my-tomcat:v1
Error response from daemon: failed to resolve reference “localhost:5000/my-tomcat:v1”: failed to do request: Head “https://localhost:5000/v2/my-tomcat/manifests/v1”: dial tcp [::1]:5000: connect: connection refused
I also forgot to mention I am trying this from a work laptop.
Am I doing this right? Please help. Thanks.