Use Docker Compose offline by using local images and not pulling images - docker

I want to issue the docker-compose command to bring up all the dependent service containers that I have previously pulled down while inside the company network. I am outside the company network so when I try to start my environment the first thing it does is try to call out to the company network and then fails with:
ERROR: Error while pulling image: Get http://myartifactory.service.dev:5000/v1/repositories/my_service/images: dial tcp 127.0.53.53:5000: getsockopt: connection refused
How can I force docker-compose to use the local images and not try to pull down the latest?

You can force docker-compose to use local images by first running:
docker-compose pull --ignore-pull-failures

Related

pushing docker image to registery of docker on a different host machine

I have two computers both have docker, I want to keep my docker image I made to the other host the does not connect to internet but is on local LAN.
so this is my machine (I use hello-world image example)
macHost:~ ciasto$ docker tag hello-world 192.168.0.6:5000/hello-world
then I try docker push 192.168.0.6:5000/hello-world
but this throws error:
The push refers to a repository [192.168.0.6:5000/hello-world]
Get https://192.168.0.6:5000/v2/: dial tcp 192.168.0.6:5000: getsockopt: connection refused
so I tried without 5000 port.
$ docker push 192.168.0.6/hello-world-2
that too throw same error:
The push refers to a repository [192.168.0.6/hello-world-2]
Get https://192.168.0.6/v2/: dial tcp 192.168.0.6:443: getsockopt: connection refused
what am I doing wrong ?
The Docker Registry is a specific piece of software; you can't directly docker push an image to another system.
The best workflow is almost certainly to write a Dockerfile that describes how to build your image. This is a simple text file, not totally unlike a shell script, that you'd typically add to your source code repository. Then on the other system you could check out the repository and run docker build and get a functionally equivalent image.
If you have a semi-isolated network you can always run your own registry. Say you set up your local DNS such that the host name my-registry.local resolves to 192.168.0.123; then you can docker tag your local images as my-registry.local/me/imagename, docker push them from one system, and docker pull them from the other.
The lowest-maintenance, least-reproducible, highest-long-term-effort path is to docker save the image on the first system, scp or otherwise transfer it to the second system, and then docker load it there. If you're motivated, you can even do it with one step
docker save me/imagename | ssh elsewhere docker load
You're forced to do this if the "elsewhere" system is actually disconnected from the network and the "copy it to the other system" step involves copying the image file on to removable media. If you're doing this at all regularly, though, or have more than one target system, you'll probably find setting up a local registry to be a good investment.

How to connect to the external server from docker container?

I have a redis running on my localhost and the docker container which trying connect to that redis, but it cannot do that. I receive this error in terminal:
AbortError: Stream connection ended and command aborted. It might have been processed.
One way to solve that is to use redis in another container and to link it to my existing container. But I need to have redis running on real host.

In virtual-machine Docker push to private registry failed under proxy

I want to push a Docker image to a private registry in the local machine.
The docker is running in a virtual-machine CentOS 7 and I'm working a in a network under a proxy.
What I did is to tag my Docker local image "test_bench_image" obtained from building a dockerfile:
docker tag test_bench_image localhost:5000/test_bench_image
and then I tried to push it:
docker push localhost:5000/test_bench_image
What I get is:
The push refers to a repository [localhost:5000/test_bench_image]
Put http://localhost:5000/v1/repositories/test_bench_image/: dial tcp 127.0.0.1:5000: getsockopt: connection refused
I understood that /etc/sysconfig/docker should include the variable no_proxy to allow pushing to private Docker registry under a proxy. So I included in the file:
...
http_proxy="http://myproxy.es:80"
https_proxy="http://myproxy.es:80"
no_proxy="127.0.0.1:5000"
But I get the same error message after reload the daemon and restart the docker service.
Any help will be really welcome.
Note: My original plan was to use the Docker local image in Jenkins. But the Docker plugin cannot pull the local image since it is not publicly available. So I tried to create a private registry and force Jenkins to pull it from there.
Thanks.
I ran into a similar issue and I had to additionally uncomment and add my private registry's host IP in the section INSECURE_REGISTRY='XX.XXX.XXX.XXX:5000' in /etc/sysconfig/docker file.

docker private registry within local network

I've set up a private registry for docker, everything works greate from outside (i've a server with several VMs, one of these is the reposiotry).
From my pc I can do docker login -u USER -p PASS repo.mydomain.com and it works great.
Now, from inside another VMs if i do the same i get back Error response from daemon: Get https://repo.mydomain.com/v1/users/: dial tcp 10.236.8.111:443: getsockopt: connection refused
It seems that the repo.mydomain.com is resolved at the local (intramachine) IP, and then the repository hangsup or does not allow the connection to pass by. Or other reasons which I don't know now.
How can I make it working?
So, the workaround is to use it as insecure docker repository, since intercomunication is within the local network. to do so:
edit /etc/docker/daemon.json adding { "insecure-registries":["repo.mydomain.com:5000"] }
restart docker service docker restart
do the login using the port 5000 docker login -u USER -p PASS repo.mydomain.com:5000
now it says login successfully. Wondering if there's a better (cleaner) way to do it.
PS: to pull the data you have to use repo.mydomain.com:5000/image

Docker: Issue with pulling from a private registry from another server

I just started learning docker.
I have a private registry running on one server(server1), and can pull a test image from it on server1 by typing the following:
docker pull 127.0.0.1:5000/test
However, when I type the above command from another server, I get the error message below:
Error: Invalid Registry endpoint: Get http://127.0.0.1:5000/v1/_ping: dial tcp 127.0.0.1:5000: connection refused
Am I missing something in configuration?
Any help is appreciated.
Thanks!
The IP 127.0.0.1 refers always to the local machine. So when you call 'docker pull 127.0.0.1:5000/test' from another machine, you must use the real IP of the server, not 127.0.0.1.
Maybe try to ping the Server first by calling http://XXXXXXX:5000/v1/_ping from the other machine to make sure it is available and you use the correct IP.
Docker 1.3 added '--insecure-registry' parameter which allows you to pull from a remote private registry. Refer this: Setting up a remote private Docker registry

Resources