Skip to content

Instantly share code, notes, and snippets.

@zhenyanghua
Last active November 6, 2018 03:31
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 zhenyanghua/54026492bf9d5749433369fa56401183 to your computer and use it in GitHub Desktop.
Save zhenyanghua/54026492bf9d5749433369fa56401183 to your computer and use it in GitHub Desktop.
K8s Notes

Inspect container and filter by its property

docker inspect -f '{{ .NetworkSettings.IPAddress }}' container_name

Run a nginx container in a detached interactive terminal that maps the host port 8088 to the nginx webserver port and open a shell in the interactive terminal.

docker run -dit --name my-nginx -p 8088:80 nginx /bin/bash 

Enter the shell

docker attach my-nginx

Exit the shell while keeping the nginx running

Ctl P, Ctl Q

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment