I have made a script task to run during a build and it should build and start some docker containers based on dockerfiles but it gives me the following error:
Building proxy... Couldn't connect to Docker daemon at http+unix://var/run/docker.sock - is it running? If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
I have made some tests accessing ec2 instance and trying to run simple docker commands like
docker ps
When I run as bamboo or ec2-user user
su - bamboo -c "docker ps" # or su - ec2-user -c "docker ps"
it shows me the error:
su - bamboo -c "docker ps" 2015/02/09 12:34:05 Get http:///var/run/docker.sock/v1.14/containers/json: dial unix /var/run/docker.sock: permission denied su - ec2-user -c "docker ps" 2015/02/09 12:34:05 Get http:///var/run/docker.sock/v1.14/containers/json: dial unix /var/run/docker.sock: permission denied
When I run as root it runs normally:
sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
What should I do to run this script?
There are two parts of it.
Docker service must be started as a root, so it's best done during system startup etc.
Docker client can be accessed with user that is not root but is in docker group. It depends on docker version as it was changing.
Look here: http://askubuntu.com/questions/477551/how-can-i-use-docker-without-sudo
Or here: https://docs.docker.com/installation/ubuntulinux/#giving-non-root-access
Hello Pawel.
First of all I would like to thank you.
I made a change in the script task to run with "sudo". It worked fine. I am facing another issue now:
"...Service 'redis' failed to build: Error pulling image (unstable) from debian, Driver devicemapper failed to create image rootfs..."
Seems to be Device Mapper vs AUFS stuff. Anyway I am still searching.
Thanks again.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
sudo is usually not the best option but it's simple so if it's enough for you that's ok too it seems race condition on device mapper is neverending story. Especially when building new image. Maybe as you suggest you can try switching to different storage. If docker and kernel is kind of new you could try "-s overlay" when starting docker service. You've probably seen this already: https://docs.docker.com/reference/commandline/cli/ (section "Daemon storage-driver option")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.