Skip to main content

Docker

· One min read

I wanted to just have a raw ubuntu install to test my dotfiles.

  1. Create Dockerfile
FROM ubuntu:latest
  1. Build image
docker build -t ubuntu .

-t creates a tag for this image, to reference it later.

  1. Run image
docker run --name ubuntu -td ubuntu

--name gives the container a name, so you can reference it later.
-t allocates a pseudo-TTY, so when all processes defined in Dockerfile are finished, the container will not exit.
-d keeps the container running in the background.

  1. Attach to container
docker exec -i -t ubuntu /bin/bash

-i interactive mode
-t allocate a pseudo-TTY
runs bash in the container and attaches to it. Uses name specified in --name.