gcgarner / IOTstack

docker stack for getting started on IOT on the Raspberry PI
GNU General Public License v3.0
1.5k stars 578 forks source link

docker-compse not recognized #172

Open AaronSchurman opened 4 years ago

AaronSchurman commented 4 years ago

After creating the docker-compose.yml with the menu I was prompted to run 'docker-compose up -d' to start my containers. When I tried this it did not recognize the command spitting back '-bash: docker-compose: command not found'. How do I get this command to work?

dgoadby commented 4 years ago

If you have not specifically installed it this will help you: http://dockerlabs.collabnix.com/intermediate/workshop/DockerCompose/How_to_Install_Docker_Compose.html or here: https://docs.docker.com/compose/install/ . Of course I am assuming that the Docker Engine is already installed.

Paraphraser commented 4 years ago

This is a bit puzzling. When you follow the installation instructions you are told to:

$ cd ~/IOTstack
$ ./menu.sh

and then choose the first option (highlighted below) to install Docker:

IMG_0718

Assuming you chose "Install Docker", you should be able to run:

pi@iot-hub:~ $ which docker docker-compose

and get the answer:

/usr/bin/docker
/usr/bin/docker-compose

If you don't get that answer then, logically, either you skipped the option to install Docker or you chose it but something went wrong.

If you don't remember choosing the first option (which finishes off by recommending a reboot) then just go back and do it again. The lines of code in the menu.sh script that get executed when you choose "Install Docker" are:

        if command_exists docker; then
                echo "docker already installed"
        else
                echo "Install Docker"
                curl -fsSL https://get.docker.com | sh
                sudo usermod -aG docker $USER
        fi

        if command_exists docker-compose; then
                echo "docker-compose already installed"
        else
                echo "Install docker-compose"
                sudo apt install -y docker-compose
        fi

You can see that (a) the script checks before doing each step so it will "self repair" without harming anything else and (b) if that still isn't working for some reason then you can try doing the various bits by hand to see if you can figure out where the error is.

Hope this helps.