I'm trying to run an image from a private registry with docker swarm.
I have an image I've tagged and pushed to a private registry. If I run this locally:
docker run -p 8000:8000 -d registry.mydomain.com:8080/myimage
it runs fine.
If I activate my swarm and try and run from there:
$(docker-machine env --swarm swarm-master)
docker login registry.mydomain.com:8080
docker run -p 8000:8000 -d registry.mydomain.com:8080/myimage
I get "Authentication is required".
I'm actually trying to do this via the docker remote API, but first I figure I should get it running on the command line.
Is this possible?
Thanks!
Just curious, you are using authentication, but no SSL? I think docker only supports basic authentication over SSL. You could try to start docker with the insecure flag to at least try out the capabilities of swarm.
docker -d --insecure-registry registry.mydomain.com:8080
The error you are getting is probably docker swarm host trying to pull down the image from your registry first since run can be short hand for pull me this image and run it.
Related
I want to setup a rancher server and a rancher agent on the same server.
Here is what i have done for creating server:
docker run -d --restart=unless-stopped -p 8080:8080 rancher/server:stable
Then, I have opened my web-browser on 8080 port.
I have chosen a login/password and enabled access control.
Then i wanted to create a host (agent). Rancher web interface says me to type this command:
docker run -e CATTLE_AGENT_IP=x.x.x.x --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.10 http://nsxxx.ovh.net:8080/v1/scripts/yyyy:1514678400000:zzzz
I have no error message, but I do not see any entry in host section (in rancher web interface).
So I tried to execute a shell on the agent docker container:
docker exec -ti xxxxx /bin/bash
I tried to manually run run.sh script and here is what I see:
Error: No such image or container: nsxxx
I suppose this is because docker containers cannot communicate together, but I have done exactly what is in the documentation...
Thanks for your help
For docker exec your need to replace the xxxxx string with the container id or the name of the container. Both you get from the docker ps command
On my host machine, I have installed docker. Then I pull a Jenkins image.
I want to run that image like daemon service like some services runs on my host machine after rebooting my machine every time. And how can I fix Jenkins port permanent(like 8080) in mine docker?
docker run -d --restart always -p 8080:8080 -p 50000:50000 -v /your/home:/var/jenkins_home jenkins
-d: for running the container in background
--restart always: for the container to always restart (unless manually stopped), it will start automatically at boot.
The rest of the arguments are from the jenkins image documentation, you may need to adapt your port mapping and volume path.
Any suggestions on how best to connect to a swarm for continuous deploy (within CI)? I'm using docker cloud, and CircleCI 2.
Tried dockercloud/client
e.g.
docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock -e DOCKER_HOST dockercloud/client -u ${DOCKER_LOGIN} -p ${DOCKER_PASSWORD} myapp/app
However, since I'm using CircleCI 2 I'm having an issue when I switch to the other docker host as following
Cannot connect to the Docker daemon at tcp://XXX:XXX. Is the docker daemon running?
This is an issue due to the remote docker they setup for security reasons from what I understand, so I don't think it's possible.
What I would like to achieve is simply to connect to the swarm and call docker stack deploy ...
Any help would be appreciated.
I'm trying to set up a workflow where I can git pull a docker container from a git repository on a local machine, then push it to a private docker registry where many people can access it. The issue is, I want it so anyone from any machine anywhere will be able to pull from this registry GRANTED they have some sort of authentication. Sort of like a private web hosted docker cloud. Is that possible?
If you aren't squeamish, I would thoroughly recommend Portus
[https://github.com/SUSE/Portus][1]
as a means to secure and manage your registry.
The registry itself can be set up in one command;
docker run -d -e SEARCH_BACKEND=sqlalchemy --restart always -v /var/docker/registry/conf:/etc/docker -v /var/docker/registry/data:/var/lib/registry -p 5000:5000 --name registry registry:2
See https://docs.docker.com/registry/deploying/ for a detailed reference.
I generally prefer to run the registry without SSL, offloading all SSL to a shared haproxy (also a docker container).
I am trying to set up a private Docker registry. I [found this tutorial](https://github.com/docker/distribution/blob/master/docs/deploying.md
) which states I need to run:
docker run -d -p 5000:5000 --restart=always --name registry registry:2
But this implies that Docker is already installed & running on the server. So I created a new Ubuntu 14.04 (upstart-based) VM and installed Docker [using the recommended procedure](https://docs.docker.com/installation/ubuntulinux/#installation
) and verified that Docker is running by using docker -v.
A few concerns/issues here:
If Docker is already installed as an upstart service/daemon, how do I configure it to run using the “Registry Mode” command?
I need Docker to run using the registry command shown above, but it’s already running on the VM. How do I get modify the service/daemon to run the registry command, do I need to configure upstart?
Where can I find docs on the arguments passed into this registry command?
I can’t find any docs on what these various command-line args are. 5000:5000…what does that do?!? --restart=always? Any links/ideas?
Docker Registry is just another container that runs on your Docker Host.
The --restart=always will set the container to restart if it goes down. (Like after a system reboot)
The 5000:5000 is the published port mapping for the container, Docker Registry will listen on port 5000.
Good documentation can be found here