How to override the default value of COMPOSE_HTTP_TIMEOUT with docker-compose command - docker

I have docker-compose which fetches some of the images and builds one.
When I run docker-compose up , I am getting the following error
ERROR: An HTTP request took too long to complete. Retry with --verbose
to obtain debug information. If you encounter this issue regularly
because of slow network conditions, consider setting
COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60).
Question: How to pass the COMPOSE_HTTP_TIMEOUT with docker-compose command?

COMPOSE_HTTP_TIMEOUT is an environment variable, so
COMPOSE_HTTP_TIMEOUT=200 docker-compose up

You need your COMPOSE_HTTP_TIMEOUT at your docker instance level (docker-compose up) and not inside your docker image. So the solution is to create a .env file and put this inside:
#.env
COMPOSE_HTTP_TIMEOUT=200
you can check the doc here

For Mac users, restarting docker from the status bar icon fixed this issue:

restart the docker
command: sudo service docker restart
then try docker-compose up

I faced this issue recently. Even after overriding the default COMPOSE_HTTP_TIMEOUT value it did not work for me.
Possible cause As mentioned in documentation Compose CLI environment variables
COMPOSE_HTTP_TIMEOUT: Configures the time (in seconds) a request to the Docker daemon is allowed to hang before Compose considers it failed. Defaults to 60 seconds.
Removing the tty:true from my docker-compose worked for me.
More details on the issueCompose error "HTTP request took too long to complete" #3633
Docker Environment details:
$ docker-compose version
docker-compose version 1.18.0, build 8dd22a9
docker-py version: 2.6.1
CPython version: 2.7.13
OpenSSL version: OpenSSL 1.0.1t 3 May 2016
$ docker version
Client:
Version: 18.09.1
API version: 1.39
Go version: go1.10.6
Git commit: 4c52b90
Built: Wed Jan 9 19:35:01 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.1
API version: 1.39 (minimum version 1.12)
Go version: go1.10.6
Git commit: 4c52b90
Built: Wed Jan 9 19:06:30 2019
OS/Arch: linux/amd64
Experimental: false

Add this one in .env file: COMPOSE_HTTP_TIMEOUT=1000

I had faced similar issue as below:
Quick Solution is, to restart your VM
sudo su - root
reboot -f
Then login again after 5-10 mins and check. It should work now!

Open terminal and type following command
COMPOSE_HTTP_TIMEOUT=200
To verify type
echo $COMPOSE_HTTP_TIMEOUT
Output: 200

Related

Timeout exceeded when trying to pull hello-world image on wsl2 windows10

I install wsl2 (ubuntu 20.04) on my windows system and I am having troubles with docker. I am not able to run simple hello-world image because I get following error:
Error response from daemon: Get "https://registry-1.docker.io/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
I configured resolv.conf by adding nameserver 8.8.8.8 and 8.8.4.4 because I've read that this helped some people but it didn't work for me.
My version of docker:
Version: 20.10.9
API version: 1.41
Go version: go1.16.8
Git commit: c2ea9bc
Built: Mon Oct 4 16:08:29 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.9
API version: 1.41 (minimum version 1.12)
Go version: go1.16.8
Git commit: 79ea9d3
Built: Mon Oct 4 16:06:37 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.11
GitCommit: 5b46e404f6b9f661a205e28d59c982d3634148f8
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.19.0
GitCommit: de40ad0
I tried to restart docker - sudo service docker restart but it also didn't help.
I am out of ideas how to fix this. Can anybody help me with this issue?
This problem happend to me too.
I found this article helpful.
https://serverfault.com/questions/908141/docker-pull-tls-handshake-timeout
It provides temporary solution, like docker pull ${IMAGE} separately.
It helped me.
P.S. This error is not common, it may be caused from time to time, so don't spend too much time on it :)
I started getting this error on a Centos 7 server. The cause was wrong proxy settings: the network team of my company removed the need for a proxy and I checked that no HTTPS_PROXY env variable was set on the server but in my case the proxy setting for Docker was in /etc/systemd/system/docker.service.d/http-proxy.conf as described in this page.
BTW, I also tried updating Docker but yum didn't work either: it has its own proxy settings in /etc/yum.conf.

Docker cannot access any Internet URL during build

I have the following Dockerfile:
FROM mcr.microsoft.com/windows/servercore:ltsc2019
SHELL ["powershell", "-Command"]
RUN Invoke-WebRequest -UseBasicParsing http://www.google.com
On my Windows 10 machine, I run docker build . and get the following:
Basically, Docker is unable to access any Internet URL I try. I can run the same Dockerfile on my Windows Server 2019 Core machine and everything works fine. I'm running Docker version 18.09.2 and haven't updated it recently. This was working a few days ago, so it's a new issue. I've tried restarting the Docker engine and also rebooting. I've also tried a docker system prune. Any ideas what broke this? I'd rather not reinstall Docker if possible.
Docker Info:
Client: Docker Engine - Community
Version: 18.09.2
API version: 1.39
Go version: go1.10.8
Git commit: 6247962
Built: Sun Feb 10 04:12:31 2019
OS/Arch: windows/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.2
API version: 1.39 (minimum version 1.24)
Go version: go1.10.6
Git commit: 6247962
Built: Sun Feb 10 04:28:48 2019
OS/Arch: windows/amd64
Experimental: false
Update: Seems to be DNS related. I can ping things.
This is a known issue with ltsc2019 images (https://github.com/Azure/AKS/issues/1029). Put following at the start of your dockerfile or before entrypoint
Set-DnsClientServerAddress -InterfaceIndex (Get-NetAdapter).IfIndex -ServerAddresses ('8.8.8.8')

docker run command hangs until the container stops

I am trying to run a PPTP VPN server in a Docker container. but when I do the command docker run pptpserver, or all different container I have tried, It will work but my cursor is just flashing and does not let me do any other command.
I tried a super simple one, just copying test.sh in the container and run it, and it prints a confined times test, but I want a container that's in the background.
test.sh:
#/bin/bash
while :; do
echo "test"
sleep 2
done
The only way I can stop it is to stop the container in another terminal. Is there something I can do to just run a container like it shouts do, in the background.
# docker version
Client:
Version: 17.12.1-ce
API version: 1.35
Go version: go1.10.1
Git commit: 7390fc6
Built: Wed Apr 18 01:23:11 2018
OS/Arch: linux/amd64
Server:
Engine:
Version: 17.12.1-ce
API version: 1.35 (minimum version 1.12)
Go version: go1.10.1
Git commit: 7390fc6
Built: Wed Feb 28 17:46:05 2018
OS/Arch: linux/amd64
Experimental: false
To prevent this, you should start a container in detached mode by specifying -d=true or just -d option. If this is not specified, docker defaults to foreground mode which attaches the console to the process inside your container's standard input, output and standard error, which makes it appear as if your terminal is "hanging".
So try:
docker run -d pptpserver
You can read more about this behaviour in the Docker Run Reference documentation.

HNS failed with error : The parameter is incorrect

I am making a docker containerized application using visual studio 2017.
When running docker through visual studio first, I got an error that "ERROR: client version 1.22 is too old".
This error was resolved by updating docker compose to version 2.1
Below link contains further instruction about this specific error
ERROR: client version 1.22 is too old
After this error was resolved ,On Building docker now I get "HNS failed with error : The parameter is incorrect."
From multiple github discussion I have found that it is a windows network error.
Is there a solution to this problem ?
Should I down grade docker version or install something else.
I am using windows container.
On running docker version
Client:
Version: 17.06.0-ce
API version: 1.30
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:30:30 2017
OS/Arch: windows/amd64
Server:
Version: 17.06.0-ce
API version: 1.30 (minimum version 1.24)
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 22:19:00 2017
OS/Arch: windows/amd64
Experimental: true
Edit:
If I switch to linux container this problem is solved.
But another issue occurs drive is not shared.
After sharing d: drive drive sharing issue still occurs.
How can I resolve linux container drive sharing issue.
I want to use windows container locally so that I can deploy this app on azure.
This is a known limitation. At present windows only supports one NAT network. Removing Netnat by invoke Remove-Netnat is not supported.
Run this in powerhell.
Get-NetNat | Remove-NetNat
To prevent docker-compose from creating a new default network you can use the existing one by specifying it in docker-compose.yml:
networks:
default:
external:
name: nat
To check for existing networks execute
docker network ls
Open the powershell(X64) in admin mode
Execute below command
Get-NetNat
If it returns something like this
Then run below command in powershell
Remove-NetNat

Certificate error in docker

I'm behind a corporate firewall and have installed Docker on an Ubuntu 14.04 LTS server. Following instructions at http://docs.docker.com/linux/step_one/.
Things seemed to be OK:-
$ docker version
Client:
Version: 1.9.1
API version: 1.21
Go version: go1.4.2
Git commit: a34a1d5
Built: Fri Nov 20 13:12:04 UTC 2015
OS/Arch: linux/amd64
Server:
Version: 1.9.1
API version: 1.21
Go version: go1.4.2
Git commit: a34a1d5
Built: Fri Nov 20 13:12:04 UTC 2015
OS/Arch: linux/amd64
... but I can't pull and run any images. Example:-
$ docker run hello-world
gives:
Error while pulling image: Get
https://index.docker.io/v1/repositories/library/hello-world/images:
x509: certificate is valid for FG3K6C3A15800002, not index.docker.io
Have spent ages searching around - I don't understand what the issue is - I've set http_proxy and https_proxy env vars but not sure what to try next. The docs don't mention any certificate requirements.
Any help appreciated!
The problem may be the proxy. If you are using a proxy to access the internet, you have to change the file /etc/default/docker and put your proxy on it.
export http_proxy="http://proxy_ip:proxy_port"
export https_proxy="http://proxy_ip:proxy_port"
After do it, restart the service:
sudo service docker restart
It works to me.
Hey Pravins I have the same issue, with my docker 1.11.2 It seems is not taken proxy settings from /etc/default/docker and from env neighter.
So what I did was what it says here
http://docs.master.dockerproject.org/engine/admin/systemd/#http-proxy
Many Linux distributions use systemd to start the Docker daemon.
You need check if the docker.service uses an EnvironmentFile, and/or You can customize the Docker daemon options using override files as explained in the HTTP Proxy example below.

Resources