haxorof/ansible-role-docker-ce

docker-compose does not work with sudo

haxorof opened this issue · 0 comments

Seems that it differs in some distributions what path is being set when using sudo. On a CentOS it is clearly different paths when entering a shell using the two different ways seen below:

[vagrant@localhost ~]$ sudo -i
[root@localhost ~]# printenv PATH
/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

[vagrant@localhost ~]$ sudo su -
[root@localhost ~]# printenv PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

According to Docker documentation (https://docs.docker.com/compose/install/#install-compose) the compose shall be located under /usr/local/bin but in CentOS installation that will not work if sudo is used.