Am I trying to connect to a TLS-enabled daemon without TLS?

前端 未结 20 2268
暗喜
暗喜 2020-11-28 17:56

I\'m trying to learn about Docker, but I keep getting cryptic (to me) error messages.

Possibly the simplest example of this is trying to print the version of Docker

相关标签:
20条回答
  • 2020-11-28 18:45

    For me, running $(boot2docker shellinit 2> /dev/null) fixed the problem.

    This runs the output of the boot2docker shellinit command (the three set -x ... lines) in your current terminal session, which lets the docker command know where to find the boot2docker virtual machine.

    Adding $(boot2docker shellinit 2> /dev/null) to the bottom of your ~/.bash_profile file will make sure the docker command is configured, every time you open your terminal.


    For people using Fish shell: boot2docker shellinit ^ /dev/null | source.


    Note that 2> /dev/null (and the Fish equivalent ^ /dev/null) are optional. Like @pablo-fernandez suggested, this hides the Writing .. lines.

    0 讨论(0)
  • 2020-11-28 18:45

    Make sure the Docker daemon is running:

    service docker start
    

    That fixed it for me!

    0 讨论(0)
  • 2020-11-28 18:45

    It is possible that you do not have the permission to the file yet. It happened to me after I add myself to dockergroup using

    sudo gpasswd -a user docker
    

    but not yet logout.

    To resolve this, you can either re-login, or use sg docker "docker <subcommand> ..." before you logout.

    If you are in group docker in /etc/group, you should be able to run it without typing password.

    https://dingyichen.wordpress.com/2015/02/05/docker-dial-unix-varrundocker-sock-no-such-file-or-directory-are-you-trying-to-connect-to-a-tls-enabled-daemon-without-tls/

    0 讨论(0)
  • 2020-11-28 18:45

    On Ubuntu after installing lxc-docker you need to add your user to the docker user group:

    sudo usermod -a -G docker myusername
    

    This is because of the socket file permissions:

    srw-rw---- 1 root docker 0 Mar 20 07:43 /var/run/docker.sock
    

    DO NOT RUN usermod WITHOUT "-a" as suggested in one of the other comments or it will wipe your additional groups setting and will just leave the "docker" group

    This is what will happen:

    ➜  ~  id pawel
    uid=1000(pawel) gid=1000(pawel) groups=1000(pawel),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),108(lpadmin),124(sambashare),998(docker)
    ➜  ~  usermod -G docker pawel
    ➜  ~  id pawel               
    uid=1000(pawel) gid=1000(pawel) groups=1000(pawel),998(docker)
    
    0 讨论(0)
  • 2020-11-28 18:46

    You will need to do:

    $boot2docker init
    $boot2docker start
    

    The following settings fixed the issue:

    $export DOCKER_HOST=tcp://192.168.59.103:2376
    $export DOCKER_CERT_PATH=/Users/{profileName}/.boot2docker/certs/boot2docker-vm
    $export DOCKER_TLS_VERIFY=1
    
    0 讨论(0)
  • 2020-11-28 18:47

    I tried the solutions here, and boot2docker didn't work.

    My solution: Uninstall boot2docker on the Mac, install a Centos 7 VM in VirtualBox, and work with Docker inside that VM.

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