Published: Draft
Written By: Ng Jun Hao
sudo systemctl enable --now docker
- Start on bootsudo systemctl status docker
- Check Docker
servicesudo usermod -aG docker $USER
- Add current user to
Docker groupdocker ps
- Check installationsudo docker container run hello-world
- Pull and run
hello-world image from Docker Hubsudo docker container ls
- List containerssudo docker container run -it ubuntu /bin/bash
- Enter
the ubuntu container with interactive shellsudo docker container run -dit ubuntu /bin/bash
- Start
ubuntu container in backgroundsudo docker container attach c59dd04833466e
- Interact
with background containersudo docker container run -dit --name webserver -p 8080:80 ngnix
- Start a ngnix server and expose portsudo docker container cp index.html webserver:/usr/share/ngnix/html/index.html
- Copy into containersudo docker contianer stop webserver
- Stop
containersudo docker container prune
- Remove stopped
containerssudo docker image ls
- List imagessudo docker image pull alpine
- Get image from
registrysudo docker image pull gcr.io/google-samples/hello-app:2.0
- Pull image from other placessudo docker image build -t ngnix:version1
- Build an
imagesudo docker container run -dit --name webapp -p8081:80 nginx:version1
- Create container