docker: Docker and dind 17.07.0 image fail build with gRPC error
I’ve been using docker:17 and docker:17-dind for some time now to run DIND builds within Gitlab Runners. Recently I rebuilt my images that extend on them (for the purposes of trusting self-signed certificates) to use docker:17.07.0 and docker:17.07.0-dind and began to receive the following errors executing Docker CLI commands:
$ docker build -t test .
ERRO[0000] failed to dial gRPC: unable to upgrade to h2c, received 501
Reproduction is simple:
# Set up DIND to demo
$ docker run --rm --name=dind --privileged -it docker:17.07.0-dind
# In new terminal window
# Demo 501 failure with 17.07.0 docker to 17.07.0 dind
$ docker run -it --link dind -e DOCKER_HOST=tcp://dind:2375/ docker:17.07.0 sh -c 'cd /tmp; echo FROM alpine > Dockerfile; docker build -t test .'
Sending build context to Docker daemon 2.048kB
ERRO[0000] failed to dial gRPC: unable to upgrade to h2c, received 501
context canceled
What revealed the reason for this problem to me was the following output from the DIND container:
...
ERRO[0097] Handler for POST /session returned error: This experimental feature is disabled by default. Start the Docker daemon in experimental mode in order to enable it.
ERRO[0097] Handler for POST /build returned error: no active session for 9acfb9acfb9acfb9acfb9acfb9acfb9: context canceled
...
This problem is also seen when using docker:17.06.0 with docker:17.07.0-dind, but it is less obvious as the DIND output doesn’t indicate anything happening as I assume API handlers do not exist for those endpoints.
# Set up DIND to demo
$ docker run --rm --name=dind --privileged -it docker:17-dind
# In new terminal window
# Demo 404 failure with 17.07.0 docker to 17-dind (17.06.0 presently)
$ docker run -it --link dind -e DOCKER_HOST=tcp://dind:2375/ docker:17.07.0 sh -c 'cd /tmp; echo FROM alpine > Dockerfile; docker build -t test .'
Sending build context to Docker daemon 2.048kB
ERRO[0000] failed to dial gRPC: unable to upgrade to h2c, received 404
context canceled
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 27 (5 by maintainers)
I disabled ‘experimental features’ in the preferences pane, and this problem went away (Mac OS X high seirra) 🤔
I enabled ‘experimental features’ in the preferences pane, and this problem on Mac OSX high sierra went away’
macOS High SIerra 10.13.3 With docker Version 2.0.0.2 (30215) (Engine: 18.09.1)
I had this problem WITHOUT the experimental features checkbox originally checked. After checking this checkbox, restarting, I was able to successfully run my command. Then I tried to uncheck the “experimental features” checkbox, and it was still working.
Basically toggling on and then back off the checkbox (with restarts) was of help
Same here. Setup:
Unchecked Experimental features and the build works.
OS X 10.14 Mojave
Docker Version 18.06.1-ce-mac73 (26764), which as it helpfully reminds us, is
Disabling “experimental features” and restarting the docker daemon fixed it.
Where is the upstream issue that this should be posted at? Can no one be bothered?
This problem also came out when I ran the command
docker build -t friendlyhello .on my linux machine.I ended up solving the problem by running the same command with sudo.
sudo docker build -t friendlyhello .Not sure but in context of windows maybe it needs root permission ? because message
clearly states it wanted to upgrade or install and windows didn’t give it permission to do so.
I had the same error with macOS Mojave, but what did it for me was simply waiting until the status changed for starting to running.
This is a repo for the docker official image in the hub. Please create an issue in moby/moby (or docker/for-win if you think this is windows specific as a lot of reports seem to come from there) with full description and reproduction steps. The original issue was related to how the official image was called with a specific
DOCKER_HOSTvariable and was fixed. The other reports seem different.Docker app version: 18.03.0-ce-mac60 (23751) Error: ERRO[0003] failed to dial gRPC: unable to upgrade to h2c, received 502
Disabling “experimental features” worked for me on macOS High Sierra.
time=“2020-02-02T01:29:18+05:30” level=error msg=“failed to dial gRPC: unable to upgrade to h2c, received 500” error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&session=uufk1i1e1el43ajd04p409in2&shmsize=0&t=spring-boot-docker-ex&target=&ulimits=null&version=1: context canceled
Disabling “experimental features” worked for me too on macOS High Sierra.
Any idea what’s the cause of this?
I run: docker build -t sparkgx . time=“2017-12-28T15:58:06+03:00” level=error msg=“failed to dial gRPC: unable to upgrade to h2c, received 502” context canceled