docker-machine
List all Docker engines
docker-machine ls
Create a Docker engine
docker-machine create --driver virtualbox default
Set environment variables for Docker engine
docker-machine env default
eval $(docker-machine env default)
Start the Docker engine
docker-machine start default
Stop the Docker engine
docker-machine stop default
Retrieve the IP address of the running Docker engine
docker-machine ip default
Docker Image
List Docker images
docker images
Delete Docker image
docker rmi <image_id>
docker image rm <image_id>
Create Docker image (Requirement: Dockerfile)
docker build -t <dockerhub_username>/<custom_docker_image_name>.
Docker Contaniners (containers)
List Docker containers
docker ps docker container ls -a
Stop and remove the Docker container
docker stop <container_id>
docker rm <container_id>
Delete all stopped Docker containers
docker container prune
Create Docker container (requirement: Docker image)
docker run --name <custom_container_name> -p <new_port>:<defined_port> -d <dockerhub_username>/<custom_docker_image_name>
docker-compose
Develop, build, run and keep running (for example, service_id equals dev)
docker-compose build <service_id>
docker-compose up <service_id>
Test, build and run once (for example, service_id equals test)
docker-compose build <service_id>
docker-compose run --rm <service_id>
Post comment 取消回复