Configure Docker to use a proxy server - asp.net

I have installed docker on windows , when I try to run hello-world for testing on docker. I get following error
Unable to find image
My computer is using proxy server for communication. I need to configure that server in the docker. I know proxy server address and port. Where I need to update this setting. I tried using https://docs.docker.com/network/proxy/#set-the-environment-variables-manually.
It is not working.

Try setting the proxy. Right click on the docker icon in system tray, go to settings, proxy and add the below settings:
"HTTPS_PROXY=http://<username>:<password>#<host>:<port>"
If you are looking to set a proxy on Linux, see here

The answer of Alexandre Mélard at question Cannot download Docker images behind a proxy works, here is the simplified version:
Find out the systemd script or init.d script path of the docker service by running:service docker status or systemctl status docker, for example in Ubuntu16.04 it's at /lib/systemd/system/docker.service
Edit the script for example sudo vim /lib/systemd/system/docker.service by adding the following in the [Service] section:
Environment="HTTP_PROXY=http://<proxy_host>:<port>"
Environment="HTTPS_PROXY=http://<proxy_host>:<port>"
Environment="NO_PROXY=<no_proxy_host_or_ip>,<e.g.:172.10.10.10>"
Reload and restart the daemon: sudo systemctl daemon-reload && sudo systemctl restart docker or sudo service docker restart
Verify: docker info | grep -i proxy should show something like:
HTTP Proxy: http://10.10.10.10:3128
HTTPS Proxy: http://10.10.10.10:3128
This adds the proxy for docker pull, which is the problem of the question. If for running or building docker a proxy is needed, either configure ~/.docker/config as the official docs explained, or change Dockerfile so there is proxy inside the container.

I had the same problem on a windows server and solved the problem by setting the environment variable HTTP_PROXY on powershell:
[Environment]::SetEnvironmentVariable("HTTP_PROXY", "http://username:password#proxy:port/", [EnvironmentVariableTarget]::Machine)
And then restarting docker:
Restart-Service docker
More information at Microsoft official proxy-configuration guide.
Note: The error returned when pulling image, with version 19.03.5, was connection refused.

Related

HTTP 403 Forbidden url error when access to docker container IIS setting server

Image of success call the swagger inside of the docker container
I success to start the Server in the docker container.
With the simple image of the Docker file, I install the dotnet sdk and hosting bundle, and set the IIS with command line.
I success to start the API Server with IIS and check with using curl inside of the docker container.
(Image is attached)
But, when I tried to call the outside from docker container, for example in my laptop, the only response is 403 Fordden url comes out.
HTTP 403 forbidden url error
I tried to compare with my local IIS setting, but every setting is exactly same.
No Managed code, and the Advance setting is same.
What's the problem?
This is the docker file I use.
# escape=`
FROM mcr.microsoft.com/windows/servercore:ltsc2019
SHELL ["powershell", "-Command"]
RUN Install-WindowsFeature Web-ASP
ADD https://download.microsoft.com/download/1/2/8/128E2E22-C1B9-44A4-BE2A-5859ED1D4592/rewrite_amd64_en-US.msi rewrite_amd64_en-US.msi
RUN Write-Host 'Installing URL Rewrite' ; Start-Process msiexec.exe -ArgumentList '/i', 'rewrite_amd64_en-US.msi', '/quiet', '/norestart' -NoNewWindow -Wait;
WORKDIR /app
COPY ./ /app
RUN mkdir C:/inetpub/wwwroot/api
COPY ./api C:/inetpub/wwwroot/api
EXPOSE 8080
and I install the dotnet-sdk3.1, dotnet-hosting-6.0.4
Please give me some advice.
Thanks in advance
I'm trying to containerize my server made with window and dotnet 3.1
But I got problem while I tried to access to exposed port.
By default, when you create or run a container using docker create or
docker run, it does not publish any of its ports to the outside world.
To make a port available to services outside of Docker, or to Docker
containers which are not connected to the container’s network, use the
--publish or -p flag. This creates a firewall rule which maps a container port to a port on the Docker host to the outside world.
For more information about container networking, please refer to this manual: https://docs.docker.com/config/containers/container-networking/

Fresh installation of Artifactory OSS 7.12.6 doesn't start, missing jffe service

I have done everything according to manuals from https://jfrog.com/open-source/ :
My Ubuntu version is 20.04. Since there is no "focal" in https://releases.jfrog.io/artifactory/artifactory-debs/, I've added "bionic":
$ cat /etc/apt/sources.list.d/artifactory.list
deb https://releases.jfrog.io/artifactory/artifactory-debs bionic main
Then I've installed jfrog-artifactory-oss version 7.12.6 and tried launching the service.
It has launched, but browser, connected to ports :8081 or :8082 of localhost, shows that 3 services don't start:
So, what does it need?
I came here, because I had the very same problem on docker.
I finally figured out, that inside the docker the environment variables http_proxy, https_proxy, HTTP_PROXY and HTTPS_PROXY where all set to localhost:8080. This caused the problem for me.
So when I start the docker this way, everything works as expected:
docker run --name artifactory-cpp-ce -ehttp_proxy="" -e https_proxy="" -e HTTP_PROXY="" -e HTTPS_PROXY="" -v $JFROG_HOME/artifactory/var/:/var/opt/jfrog/artifactory -d -p 8081:8081 -p 8082:8082 releases-docker.jfrog.io/jfrog/artifactory-cpp-ce:latest
On my machine, I found that libvirtd was running. It wasn't libvirtd, itself, that prevented artifactory from coming up. It was the fact that the virbr0 interface was up. It doesn't seem to be a problem bringing this interface back up after artifactory comes up.
For us this was on a Windows OS which was running McAfee Services. McAfee services listens on port 8081, same as the default Artifactory. Changing McAfee listening port was not an option for us.
I copied the JFROG_HOME\artifactory\var\etc\system.full-template.yaml, changed the name to system.yaml and searched for 8081 and changed it ( uncommented) to a different port. Restarted the Artifactory Service.

How do I connect to a container hosted in Docker Toolbox?

I am attempting to run my ASP.NET Core 1.1 web API in a Docker container, but I cannot connect to the web API from a browser or curl. To troubleshoot, I have also brought up standard nginx and Apache httpd containers and cannot connect to these either, so I believe this is a Docker/Docker Toolbox/configuration issue rather than a problem with my application.
I'll focus on what I have done with nginx and Apache:
I am running Docker Toolbox on Windows 7 Professional, and everything seems to work as I would expect.
Docker commands all work as expected
I can access the underlying Windows filesystem
I can get the expected results from curl http://localhost (if I start the default IIS website on Windows 7)
So now I shut down IIS and run nginx in a container:
$ docker run -d -p 80:80 nginx
45bb1f373c11b820d8431de3eb3bf222d57d412de53e8625f461b62c4279e644
Docker now shows nginx running:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
45bb1f373c11 nginx "nginx -g 'daemon off" 47 seconds ago Up 48 seconds 0.0.0.0:80->80/tcp, 443/tcp admiring_pike
But I cannot connect with either curl (within the Docker Toolbox command prompt) or a web browser in Windows:
$ curl http://localhost
curl: (7) Failed to connect to localhost port 80: Connection refused
I get exactly the same results if I run an Apache 2.4 (httpd) container.
Any ideas? Thanks! Peter
I have found the answer in another question here.
Because Docker Toolbox is running on a lightweight Linux VM, it has its own IP address. One needs either to map localhost to the VM using DOCKER_HOST ir access the VM via it's IP address, found using the command:
docker-machine ip default
As you are running on VM, you need to follow this docker document from here.
After that run the following command to check the IP address of your VM.
docker-machine ip default
Start the nginx and hit [ip default address]:port in the browser. It works!

Docker : Unable to run Docker commands

I have installed docker engine v1.12.3 on Ubuntu 14.04 LTS and since after the following changes to enable Remote API, I'm not able to pull or run any of the docker images,
Added DOCKER_OPTS="-H tcp://127.0.0.1:2375" in /etc/default/docker.
/etc/init.d/docker start.
Following is the error received,
docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?
Note: I have added login in user to the docker group
If you configure the docker daemon to listen to a TCP socket (as you do), you should use the -H command line option with the docker command to point it to that socket instead of the default Unix socket.
#mustaccio is correct. The docker command defaults to using a unix socket normally at /var/run/docker.sock. You can either make your options setup like:
DOCKER_OPTS="-H tcp://127.0.0.1:2375" -H unix:///var/run/docker.sock" and restart, or always use docker -H tcp://127.0.0.1:2375 whenever you interact with the host from the command line.
The only good scenario I've seen for removing the socket is pure user security. If your Docker host is TLS enabled, you can ensure only authorized people are accessing the host by signed certificates, not just people with access to the system.

Running Jenkins in a Docker Container

Im trying to get some hands on experience in Jenkins and wanted to run it in a docker container. I was following the tutorial here. I have docker installed on my machine and using Kitematic I launched the official Jenkins docker image (tag: latest) using:
docker run -p 8080:8080 jenkins
However once the container is setup when I go to 192.168.99.100:8080 (192.168.99.100 is my docker-machine ip) it shows the default nginx page. 192.168.99.100:8080/jenkins shows
HTTP ERROR 404
Problem accessing /jenkins. Reason:
Not Found
The weird part is that kitmatic shows a web preview of the running container and shows jenkins up and running fine, but how do I access it via the browser????
EDIT : Just tried docker run -p 8082:8080 jenkins. and it works i.e. I can see the jenkins landing page. Whaaaa.. ?
See if the port 8080 is already taken by another application. it's not allocating this port because it's taken - that is why it can't reach Jenkins. try looking here: https://www.cyberciti.biz/tips/linux-display-open-ports-owner.html

Resources