Skip to content

Instantly share code, notes, and snippets.

@anitsh
Last active March 29, 2020 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anitsh/9c29623f538718a609faba99924acf2a to your computer and use it in GitHub Desktop.
Save anitsh/9c29623f538718a609faba99924acf2a to your computer and use it in GitHub Desktop.
Docker

Docker

Docker is a set of platform as a service products that uses OS-level virtualization to deliver software in packages called containers.

Docker Context

It allows connect to remote docker instances. Runs commands on another docker host.

docker context ls //view current context values

export TGT_HOST=10.0.0.4 //remote host ip

ssh-keyscan -H $TGT_HOST >~/.ssh/known_hosts //trust the host

docker context create term2 --description "Terminal 2" --docker "host=ssh://$TGT_HOST" //create a context

docker context use term2 //use the created context

docker --context default container ls //run docker command in the default container 

What is needed to use ssh as a context?

  • Member of the docker group or root user on the remote host
  • Ability to connect with ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment