DEV Community

Cover image for Simple Ubuntu Docker Playground
Matthew Cale
Matthew Cale

Posted on

Simple Ubuntu Docker Playground

What is this?

This is a tutorial on doing Ubuntu stuffs in Docker. It is intended to be a starting off point for doing common things in pretty much any image that can run bash or sh. Other tutorials will lean on this on this foundation.

Why make this?

To keep it in a spot I remember and to share simple things with others.

Steps

# Run the image directly rather than exec into a container
docker run --name ubuntu-playground -it ubuntu bash
Enter fullscreen mode Exit fullscreen mode
  • Optional, verify your new container is running in a separate terminal window. This is a bit redundant since your terminal shell just switched, but it's good to be thorough!
docker ps
# ubuntu-playground will be in the NAMES column
Enter fullscreen mode Exit fullscreen mode
  • Install and run some stuff
# From prompt inside container
apt-get update
apt-get install -y curl jq
curl https://jsonplaceholder.typicode.com/users/1 | jq
Enter fullscreen mode Exit fullscreen mode
  • Profit 🤑

Screen Shot 2021-09-07 at 2.35.58 PM

Discussion (0)