Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/joydeep100/dockerlearn

Learning docker, Docker command reference.
https://github.com/joydeep100/dockerlearn

Last synced: about 1 month ago
JSON representation

Learning docker, Docker command reference.

Awesome Lists containing this project

README

        

## Docker Image & Container definition
Docker Image is a set of files which has no state, whereas Docker Container is the instantiation of Docker Image. In other words, Docker Container is the run time instance of images.

## Images

- docker images //List all images

- docker rmi -f //To untag and remove an image

## Process

- docker run //run an instance

- docker run -it //run in interactive mode

- docker run --name //give a custom name to a running container or image process

- docker run -it //you can override the default command, i.e. CMD as in Dockerfile

- docker run -d //run detached

- docker run -p : //port mapping

- docker run --rm //will ensure the contaier related files are removed from docker daemon when the process stops, a practical way to see this is 'docker ps -a' with this flag included you can see there will be no trace here once the container is stopped

- docker exec -it //to get access to the running container

ex. ```docker exec -it efe1f0ab1991 bash```

- docker attach //to attach to a detached & running container

## Volumes

- docker run -v : //volume mapping - use absolute and existing paths(in client node)

ex. ```docker run -v $(pwd):/app```
ex. ```docker run -v /app/src``` //it means do not touch this path in the target container

## Build

- docker build . //Ensure Dockerfile is present, '.' is the context. which means all path in local are relative to this path

- docker build -f