Can't connect to docker from docker-compose

前端 未结 24 2034
说谎
说谎 2020-12-07 10:14

I installed docker-machine 0.1.0 and docker-compose 1.1.0 on Mac OS 10.8.5.
Docker-machine is running normally and able to connect by docker-machine ssh.



        
相关标签:
24条回答
  • 2020-12-07 10:46

    Apart from adding users to docker group, to avoid typing sudo repetitively, you can also create an alias for docker commands like so:

    alias docker-compose="sudo docker-compose"
    alias docker="sudo docker"
    
    0 讨论(0)
  • 2020-12-07 10:47

    if you are using docker-machine then you have to activate the environment using env variable. incase you are not using docker-machine then run your commands with sudo

    0 讨论(0)
  • 2020-12-07 10:47

    WORKING!!
    I tried with below commands and its working

    service docker restart
    docker-compose -f docker_compose.yaml down
    docker-compose -f docker_compose.yaml up
    
    0 讨论(0)
  • 2020-12-07 10:48

    sudo systemctl start docker - to start the Docker service.

    sudo docker-compose up after that.

    I have Fedora 26, and trying to solve the same issue I eventually entered Docker Compose on Fedora Developers' page and then Docker on Fedora Developers' page, which helped me.

    Probably, docker service considered by community to start with the system and run in background all the time, but for me it was not so obvious, and that's the reason I can think of why there's no popular answer like this one.

    On the Fedora Developers' page there's instruction how to enable Docker to start with the system:

    sudo systemctl enable docker

    0 讨论(0)
  • 2020-12-07 10:48

    If you are on Linux you may not have docker-machine installed since it is only installed by default on Windows and Mac computers.

    If so you will need to got to: https://docs.docker.com/machine/install-machine/ to find instructions for how to install it on your version of Linux.

    After installing, retry running docker-compose up before trying anything listed above.

    Hope this helps someone. This worked for my devilbox installation in Fedora 25.

    0 讨论(0)
  • 2020-12-07 10:49

    logging out then in again helped me. In my case it was fresh install, I created a new user, new group then added the user to the docker group.

    exit exit

    then ssh into the server again

    0 讨论(0)
提交回复
热议问题