Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker: When trying to run docker run hello-world getting - Forbidden

This is windows 7 machine, Installed docker using docker toolbox version 1.8.2

I am behind corporate firewall.

Initially I was not able to even start the machine so I added two new environment variables: http_proxy, https_proxy and I was able to bring up the default machine

Now when I run, I get:

XXXXXX@CCCCCCC MINGW64 ~  
$ docker run hello-world
An error occurred trying to connect: Post https://192.168.99.100:2376/v1.20/containers/create: Forbidden

Please help.

ps: The other issues on stackoverflow are related to MAC and hence not applicable to me, so admins please don't waste my time in closing this item unnecessarily.

like image 949
user1414095 Avatar asked Sep 11 '15 14:09

user1414095


People also ask

How do I pass an environment variable in Docker run?

When we launch our Docker container, we can pass environment variables as key-value pairs directly into the command line using the parameter –env (or its short form -e). As can be seen, the Docker container correctly interprets the variable VARIABLE1.


3 Answers

I use a proxy and I had the error returned when I followed the docker tutorial https://docs.docker.com/get-started/part4/, after executing the following:

docker-machine env <VM name>
eval $(docker-machine env <VM name>)
docker stack deploy -c docker-compose.yml <app name>

I solved it using:

docker-machine env --no-proxy <VM name>

instead of:

docker-machine env <VM name>
like image 106
Samuel_NLP_Safety Avatar answered Oct 20 '22 10:10

Samuel_NLP_Safety


From the looks of it, the docker command-line tool is trying to use your proxy server to connect to the Docker daemon running inside your VM.

Since your host and your Docker VM are running in the same network, you probably won't need the proxy server for talking to the Docker daemon. Try setting the no_proxy environment variable in order to instruct the Docker client to not use the proxy server for that particular address:

export no_proxy=$(docker-machine ip <insert-vm-name-here>)
like image 28
helmbert Avatar answered Oct 20 '22 08:10

helmbert


So you probably have an issue with the env variables for your docker-machine Looks like it can't find the right certs under ${HOME}/.docker

Try setting your environment:

eval "$(docker-machine env default)

If nothing works remove your default docker-machine

docker-machine rm default

and re-created it.

docker-machine create default
like image 32
Rico Avatar answered Oct 20 '22 10:10

Rico