Skip to content

Instantly share code, notes, and snippets.

@mimosa
Created January 12, 2017 00:06
Show Gist options
  • Save mimosa/0ade055ae6203817c7dfdccab2d4c342 to your computer and use it in GitHub Desktop.
Save mimosa/0ade055ae6203817c7dfdccab2d4c342 to your computer and use it in GitHub Desktop.
How to connect Docker to CoreOS in Veertu

How to connect Docker to CoreOS in Veertu

Why CoreOS?

CoreOS has become the preferred distro for Docker. You can download the Stable ISO

Why Veertu?

Like xhyve, Veertu takes advantage of the Hypervisor.framework that was introduced in OS X 10.10, which brings Type 1 hypervisor technology (direct, host-level access to hardware) to OS X. You can download it in the CloudFront

  1. Start the CoreOS image.

    • Set a password for user core
    core@localhost ~ $ sudo passwd core
  2. Get the ip address

    core@localhost ~ $ ip route
    default via 192.168.64.1 dev ens3  proto dhcp  src 192.168.64.X  metric 1024 
    172.17.0.0/16 dev docker0  proto kernel  scope link  src 172.17.0.1 
    192.168.64.0/24 dev ens3  proto kernel  scope link  src 192.168.64.X 
    192.168.64.1 dev ens3  proto dhcp  scope link  src 192.168.64.X  metric 1024
  3. Ssh into CoreOS

    ssh [email protected] -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
  4. Install CoreOS

    • Get your public SSH key

      cat ~/.ssh/id_rsa.pub
    • Generate a crypted password

      openssl passwd -1
    • Create a cloud-config.yml file to upgrade CoreOS, add your ssh key and open the docker socket when CoreOS starts:

      core@localhost ~ $ vi cloud-config.yml
        #cloud-config
      
        users:
          - name: core
            passwd: # paste your a crypted string to here
            groups:
              - sudo
              - docker
            # include one or more SSH public keys
            ssh-authorized-keys:
              - # paste your a public SSH key to here
      
        coreos:
          units:
            - name: docker-tcp.socket
              command: start
              runtime: no
              content: |
                [Unit]
                Description=Docker Socket for the API
                [Socket]
                ListenStream=2375
                Service=docker.service
                BindIPv6Only=both
                [Install]
                WantedBy=sockets.target
      
            - name: docker.service
              command: start
    • Install the CoreOS to /dev/sda with our cloud config:

      core@localhost ~ $ sudo coreos-install -d /dev/sda -c cloud-config.yml
      core@localhost ~ $ sudo reboot
  5. Usage and check

    • Set the docker host

      export DOCKER_HOST=tcp://192.168.64.X:2375
    • Check if it works

      docker info
  6. Sharing folder on your Mac

    • Install Add-ons.

      brew install ssh-copy-id osxfuse sshfs
    • Auto Login without a password.

      ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected] -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no
    • Mount remote file systems over ssh.

      mkdir -p ~/Documents/veertu
      sudo sshfs -o allow_other,defer_permissions,reconnect,volname=veertu [email protected]:./ ~/Documents/veertu`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment