Skip to content

Instantly share code, notes, and snippets.

@romach
Last active February 28, 2024 10:50
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save romach/9df5fd362788ea2be5046b6d59622c77 to your computer and use it in GitHub Desktop.
Save romach/9df5fd362788ea2be5046b6d59622c77 to your computer and use it in GitHub Desktop.
Run Ubuntu in docker container
# run with connected bash with closing after exit
docker run -it --rm --name ubuntu ubuntu:18.04 /bin/bash
# run in detached mode
docker run -id --name ubuntu ubuntu:18.04
docker exec -it ubuntu /bin/bash
# run in detached mode with mounted directories
docker run -v /dir-on-host:/dir-in-container -id --name ubuntu ubuntu:18.04
docker exec -it ubuntu /bin/bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment