Click here to Skip to main content
15,885,943 members
Articles / Containers / Docker

Developer Docker Tool Configuration

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
18 Oct 2018CPOL3 min read 4.6K  
Configuring Developer Docker Tool to use BYOD VM as your Docker Host/Machine

Introduction

Recently, we got our first docker container working in DEV. There are lots of fantastic articles already written on CodeProject, which helped me lot, but I wanted to expand slightly from a developer perspective.

Pre-requisites

  • Docker DevCloud VM
  • Admin Access to your new VM - Note if you do have an issue with sudo privileges, you can use "su -" command and password abc123 or Cloud123 to access root
  • Download Cygwin - please note that you can "install under an unprivileged account just for your own usage, run setup*.exe with the <tt>--no-admin</tt> option."
  • Download Docker Tools - From Enterprise Artifact Repository - download docker-1.8.1 (latest at this time)

Configuring Cygwin

  1. Pick Install from Internet
  2. Use Default Directory but select 'All Users'
  3. Use Default Package
  4. Pick Use System Proxy Settings
  5. Pick top URL for Download Sites
  6. In Select Packages - search for and select 'openssh', 'curl' and 'socat' and select their binaries
  7. Click Next to complete install
  8. Select option to create desktop icon (when done, a shortcut for cygwin terminal should appear on your desktop):

Image 1

Configuring Docker

  1. Rename downloaded file to be Docker.exe
  2. Place file in a folder (not in c:\program files or c:\program files(x86))
  3. Update path environment variable to reference folder where Docker.exe exists:
    • Compute Properties, Advanced System Settings, Environment Variable Button, add to User Path Variable
  4. From command prompt, type 'docker version' and you should see a response from the client but no server / host response.

Image 2

Connecting Docker Client to VM

For reference (securely access docker API remotely section):

  1. Start Cygwin terminal
  2. Type 'ssh-keygen' - leave default location and passphrase alone
  3. Have admin of your BYO Docker Devcloud VM add your public key to the authorized_keys2 file (if your admin is unfamiliar, there are instructions at the bottom for them)
  4. Once VM admin has updated authorized_keys2, verify the key is working from cygwin by entering the following 2 commands:

    MYBYO=vmname 
    	ssh root@$MYBYO id
  5. If this works, you should receive a response like this one: uid=0(root) gid=0(root) groups=0(root) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
  6. Create a script called docker-tunnel, from cygwin type:
    • cat > docker-tunnel
    • Paste the following text (from step 4 of securely accessing docker instructions)
    Bash
    #!/bin/bash
    if [[ ! "$1" ]]; then
      echo "Usage: $0 hostname"
    else
      socat \
        "TCP-LISTEN:2375,reuseaddr,fork,range=127.0.0.1/32" \
        "EXEC:'ssh -kTax root@$1 socat STDIO UNIX-CONNECT\:/var/run/docker.sock'" &
        sleep 1
    fi
  • ctr-c to exit edit
    chmod +x ./docker-tunnel

Test Connection

  1. From cygwin type
    • ./docker-tunnel $MYBYO
  2. Open up browser and go to the following address, you get a json file download response
  3. Json file contents should look similar to the following:
JSON
{
  "Os" : "linux",
  "Version" : "1.10.3",
  "Arch" : "amd64",
  "ApiVersion" : "1.22",
  "GitCommit" : "7ffc8ee-unsupported",
  "KernelVersion" : "3.10.0-327.36.3.el7.x86_64",
  "BuildTime" : "2016-06-17T15:27:21.818932147-04:00",
  "PkgVersion" : "docker-common-1.10.3-44.el7.x86_64",
  "GoVersion" : "go1.4.2"
}

Final Connection Piece

  1. From cygwin type
    • export DOCKER_HOST=tcp://127.0.0.1:2375
  2. Exit cygwin and open a command prompt and type
    • docker version
  3. You should now see the host section as well as the client section completed:

Image 3

For VM Admin How to Login and Update Authorized_keys2

For reference (logging into your VM section):

  1. Start Cygwin terminal
  2. Type 'ssh -l soeid vm-computer-name'
  3. Pick yes to any prompts - if this is your first time, you will encounter an error concerning no home folder has been setup
  4. Change directory to /etc/ssh/keys/root
  5. View contents of authorized_keys2 by typing 'cat authorized_keys2'
  6. Edit authorized_keys 2 by using vim, command 'vi authorized_keys2'
  7. sudoHow edit with vim - Editing files with vi — Guide to Linux for Beginners

Hope this article will help you to Use Developer Docker tool to use BYOD VM as your Docker Machine, and Configuration required for the same.

History

  • 18th October, 2018: Initial version

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Cognizant
India India
• Since last two years followed by post-graduation from Chanakya International Institute of Leadership Studies(CIILS), Mumbai University in the field of Leadership, applied those principles in my own organization with outstanding results.
• Leading the team of Salesforce developer at the Capgemini for one of the largest implementation on Force.com platform comprising around 5000 user-base.
• Outstanding written and oral communications skills with comprehensive experience in numerous forms of marketing.
• Enthusiastic to work with intelligent minds of today to remain updated about things which can help him develop new ideas and innovate the older processes to make the world more better place to live.
• Facilitates positive change by improving thinking and the rare ability to electrify an audience yet deliver uncommonly original and useful insights that lead to individuals doing their best work, teams providing superb results and organizations becoming better.

Comments and Discussions

 
-- There are no messages in this forum --