I am setting up a deployment server. I installed docker and running docker container with a docker-composer.yaml
generated by phpdocker.io. And I also installed jenkins. All setup is on EC2 instance. Everything works perfectly.
During a push to master in github, jenkins need to make a pull and run some commands in EC2 instance. When I try to install composer dependencies I am getting below errors:
docker-compose exec php-fpm composer install
Couldn't connect to Docker daemon at http+docker://localunixsocket - is it running?
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
Build step 'Execute shell' marked build as failure
Finished: FAILURE
I try to look for many solutions but it seems somehow jenkins is not able to find docker, or not able to communicate with docker.
One of the solution which mention is docker is not running. I am logged into EC2 instance and I am sure it's running. Also I added docker to sudo.
Just to confirm here is output of $ id -nG
$ id -nG
ubuntu adm dialout cdrom floppy sudo audio dip video plugdev lxd netdev docker
As mentioned in comments, I tried to add sudo
$ sudo docker-compose exec php-fpm composer install
sudo: no tty present and no askpass program specified
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Any ideas how to solve this error? If you need more information please feel free to ask.
Thanks