Docker commands

docker build -t my-img .

docker build --no-cache --build-arg NODE_ENV=${NODE_ENV} -t my-img .

docker build -t my-img -f=my-dockerfile .
docker run -d -p 8082:8082 -v $(pwd)/data/logs:/data/logs -e 'NODE_ENV=dev' --name my-img my-img

docker run -it --name my-img my-img
docker exec -it my_image sh
docker ps -a

docker stop -t0 my-img

docker rm my-img
docker rm `docker ps -a -q`
docker images

docker rmi --force $(docker images -q)
or
docker images -q |xargs docker rmi

# remove all unused images
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
docker run -it --name python python:3.7.3-slim sh
docker run --name mongo -p 127.0.0.1:27017:27017 -d mongo
docker run --name mysql -e MYSQL_ROOT_PASSWORD=yolo -e MYSQL_DATABASE=mydb -p 127.0.0.1:3306:3306 -d mysql:5.6.39
mysql -pyolo -uroot -h 127.0.0.1 -P 3306 mydb
docker run --name elasticsearch -p 127.0.0.1:9200:9200 -d elasticsearch
docker run --name kibana -e ELASTICSEARCH_URL=http://127.0.0.1:9200 -p 5601:5601 -d kibana:latest
  • docker.txt
  • Last modified: 2019/06/27 09:06
  • by jdx