docker –version
docker pull
docker run
dockerpsdockerps-adockerexecdocker stop
dockerkilldocker commit
docker login
docker push
docker images
dockerrmdocker rmi
docker build
1. `dockerps`# current containers2. `docker run`# create and start the container3. `docker create`# create container4. `dokcer exec`# to run commnads in container for once
EX: commanddockerexec-it<container name> /bin/bash
5. `docker stop [container ID]`# terminate the container and save it's state by commit it 6. `dockerrm[container ID]`# remove container 7. `docker inspect [container ID]`# Get more info about running container
___
7. `docker images`# list the images8. `docker push`# push your image to docker repo9. `docker pull`# download an image from docker repo10. `docker commit`# create an image from container11. `docker rmi`# remove image
___
12. `docker volume`# create a docker volume13. `docker network`# create a docker network14. `docker build`# build a new image from dockerfile
Docker Commands v2.1 by BVieira
-forked from Basel Rabia
1. `dockerps`# current containers2. `docker run`# create and start the container3. `docker create`# create container4. `dokcer exec`# to run commnads in container for once5. `docker stop [container ID]`# terminate the container and save it's state by commit it 6. `dockerrm[container ID]`# remove container 7. `docker inspect [container ID]`# Get more info about running container
___
8. `docker images`# list the images9. `docker push`# push your image to docker repo10. `docker pull`# download an image from docker repo11. `docker commit`# create an image from container12. `docker rmi`# remove image
___
13. `docker volume`# create a docker volume14. `docker network`# create a docker network15. `docker build`# build a new image from dockerfile
___
16. Clean, stop, reset, purge and remove all traces of Docker in your environment
#Select all commands below and paste on terminal
```docker stop $(docker ps -q)dockerrm-f$(docker ps -aq)docker rmi $(docker images -q)docker volume rm$(docker volume ls -q)docker network rm$(docker network ls -q)docker volume prune
docker system prune -a```
dockerps# current containersdocker run # create and start the containerdocker create # create container
dokcer exec# to run commnads in container for oncedocker volume # create a docker volumedocker network # create a docker networkdockerrm# remove container docker images # list the imagesdocker rmi # remove imagedocker build # build a new image from dockerfiledocker push # push your image to docker repodocker pull # download an image from docker repodocker commit # create an image from container
docker network create name_of_network
docker pull image_name
dockerpsdockerps-adocker stop container_id or name
docker start container_id or name
docker run image_name
docker run -d image_name
docker run -d -p<machine_port>:<docker_port>-d--name=name_for_container image_name
docker network lsdocker-compose-f mongo.yaml up
docker build -t name_of_new_image:version path of dockerfile
ex. docker build -t my_app:1.0.0 ./app
docker rmi image_id
dockerrm container_id
dockerexec-it container_id /bin/bash
dockerexec-it container_id /bin/sh
dockerps-a|grep my-app (to list all the containers of a image)docker run -d-eMONGO_DB_USERNAME=admin -eMONGO_DB_PWD=password my-app:1.1 (setting env variables at the time of container creation)docker tag my-app:latest 159425601627.dkr.ecr.us-east-1.amazonaws.com/my-app:latest
docker push 159425601627.dkr.ecr.us-east-1.amazonaws.com/my-app:tag
docker logs [OPTIONS] container_id
--details Show extra details provided to logs
--follow , -f Follow log output
--since Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for42 minutes)--tail , -n all Number of lines to show from the end of the logs
--timestamps , -t Show timestamps
--until Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for42 minutes)
docker commit <id container><name image> //создать образ
docker tag <name image> MandrykaValerii/<new name image> //что б можно было закинуть на Docker Hub