Skip to content

Instantly share code, notes, and snippets.

@R4wm
Last active August 23, 2021 20:40
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 R4wm/fe3d489a12e0f4d7c1f3446d4a645fde to your computer and use it in GitHub Desktop.
Save R4wm/fe3d489a12e0f4d7c1f3446d4a645fde to your computer and use it in GitHub Desktop.
docker notes bc i forget

Get image

list found at: docker hub

docker pull ubuntu:xenial

create docker container from image id

the hash is the docker image ID
Note: the hash after -it is the image ID from docker container ls -a

$ docker container run -d -it 38b3fa4640d4 --name waflz_docker /bin/bash 
8e8253377bf91daab40481f48978c05dd5c581f35fc9952b8a14b25aab8af1f5

Enter container

yeahright:$ docker container ls 
CONTAINER ID   IMAGE          COMMAND       CREATED         STATUS         PORTS     NAMES
c44cbeef035c   38b3fa4640d4   "/bin/bash"   7 minutes ago   Up 7 minutes             waflz_docker
yeahright:$ docker exec -it waflz_docker bash 
root@c44cbeef035c:/# 

Stop and remove docker container

NOTE: the hash here is the container id

$ docker container stop baad53bb6c9d
baad53bb6c9d
[yeahright ~]$ docker container rm baad53bb6c9d
baad53bb6c9d

Docker build

cd into the directory that has the Dockerfile

docker build -t something .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment