Skip to content

Instantly share code, notes, and snippets.

@R4wm
Last active Aug 23, 2021
Embed
What would you like to do?
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