问题
ubuntu运行命令:sudo docker-compose up -d
报错:sudo: docker-compose: command not found
(qa2) user@DESKTOP-QB5ALJE:~$ sudo docker-compose up -d
sudo: docker-compose: command not found
解决办法
依次执行以下命令:
1.sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-(uname -m)" -o /usr/local/bin/docker-compose
2.sudo chmod +x /usr/local/bin/docker-compose
3.docker-compose --version
(qa2) user@DESKTOP-QB5ALJE:~$ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 664 100 664 0 0 1366 0 --:--:-- --:--:-- --:--:-- 1366
100 12.1M 100 12.1M 0 0 4209k 0 0:00:02 0:00:02 --:--:-- 5489k
(qa2) user@DESKTOP-QB5ALJE:~$ sudo chmod +x /usr/local/bin/docker-compose
(qa2) user@DESKTOP-QB5ALJE:~$ docker-compose --version
docker-compose version 1.29.2, build 5becea4c
参考资料
https://stackoverflow.com/questions/38775954/sudo-docker-compose-command-not-found