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
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.
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.
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")
Teams break work down in order to help simplify complex tasks. This is often done iteratively, with tasks being broken down into smaller tasks and so on until the work is accurately captured in well-...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events