Skip to content

Instantly share code, notes, and snippets.

@nmarley
Created December 8, 2016 13:58
Show Gist options
  • Save nmarley/0ee3e2cf14dabfb868eb818b8b30e7e0 to your computer and use it in GitHub Desktop.
Save nmarley/0ee3e2cf14dabfb868eb818b8b30e7e0 to your computer and use it in GitHub Desktop.
Docker — get container ID from within Docker container
bash-4.3# cat /proc/1/cpuset
/docker/13f8c221656e202db979d1e607c9c902282d8719ab70715978dd04ee6069d61e
bash-4.3# DOCKER_CID=$(cat /proc/1/cpuset | cut -c9-)
bash-4.3# echo $DOCKER_CID
13f8c221656e202db979d1e607c9c902282d8719ab70715978dd04ee6069d61e
@soloecho
Copy link

soloecho commented May 8, 2018

Thanks, it helps a lot.

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