Skip to content

Instantly share code, notes, and snippets.

@gilangvperdana
Forked from romach/run-ubuntu-in-docker.sh
Created February 22, 2023 06:57
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 gilangvperdana/10ad9a729b255ea19cd88eb8f3efa725 to your computer and use it in GitHub Desktop.
Save gilangvperdana/10ad9a729b255ea19cd88eb8f3efa725 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