Saturday, March 30, 2019

Play with "Play with Docker" from your terminal!

A simple, interactive and fun playground to learn Docker.
Play with Docker (PWD) is a Docker playground which allows users to run Docker commands in a web browser.
I will describe how to use your terminal in Ubuntu with openssh to play with "Play with Docker " :)


So what is docker? Docker it is a computer program that performs operating-system-level virtualization.
If you what to install docker locally go here https://docs.docker.com/install.

To test docker on Docker playground using your own terminal.
-> Open terminal either with Ctrl+Alt+T keyboard shortcuts or by searching for “terminal” from software launcher. First you need to install openssh-client with:
sudo apt install openssh-client

-> If you don't have a .ssh folder in your home directory create it with:
mkdir ~/.ssh
-> Set the correct access permissions with:
chmod 0700 ~/.ssh

-> Go to the web site and start a new instance: https://labs.play-with-docker.com
-> Copy the host information (<ip>-<session_id>@pwdhost) from the SSH text field without the ssh

-> Run ssh-keygen with:
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -P "" -C <ip>-<session_id>@pwdhost
(e.g. ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -P "" -C ip172-18-0-10-bifaaaa6chi000c2aaa0@direct.labs.play-with-docker.com)

*You need to make the key only once, the same key will be used for all the instances.

-> Apply the correct access permissions with:
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub

-> And run:
ssh <ip>-<session_id>@pwdhost
(e.g. ssh ip172-18-0-10-bifaaaa6chi000c2aaa0@direct.labs.play-with-docker.com)

Now you can play with PWD from your terminal:)

Links:
https://medium.com/@marcosnils/pwd-ssh-c12080ea11d1
https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
https://gist.github.com/grenade/6318301


3 comments:

  1. How you describe it, it is not only a workaround for the sometimes challenging interaction with the labs in-Browser-Terminal, but alo a good point to playing around on a smartphine with docker.

    But now my question:

    In case I should or want direct operate the in-browser Terminal a noticed that the communication to/from clipboard doesnt work.

    Hwo is the behavior in your case?

    ReplyDelete
    Replies
    1. COPY -> CTRL+INSERT or CTRL+FN+INSERT

      PASTE -> SHIFT+CTRL+V

      Delete
  2. Sorry for the late reply in my case is:
    SHIFT+CTRL+*
    C -for copy
    X -for cut
    V -for paste

    ReplyDelete