|
docker build -t <image_name>:<tag> <path_to_Dockerfile>
|
Build an image from a Dockerfile
|
|
FROM <image_name>:<tag>
|
Includes the OS & sometimes the runtime environment
|
|
WORKDIR /app
|
Specifies which directory to work in
|
|
COPY . .
|
Copying everythin in the root directory into app directory
|
|
RUN npm install
|
Installing dependencies
|
|
EXPORT port_number
|
Specifies port number
|
|
CMD ["command"]
|
Command runs in the container not image
|
|
docker images
|
List all images
|
|
docker image rm <image_name_or_ID>
|
Remove one or more images
|
|
docker image rm <imag_name> -f
|
Forcefully delete an image even if it is used
|
|
docker run --name <name> -p local_port:container_port<image_name>:<tag>
|
Run a command in a new container with name and specifiying the local port
|
|
docker ps
|
List running containers
|
|
docker ps -a
|
List all containers
|
|
docker stop <container_name_or_ID>
|
Stop one or more running containers
|
|
docker start
|
docker start <container_name_or_ID>
|
|
docker container rm <container_name>
|
Deleting containers
|
|
docker rm <container_name_or_ID>
|
Remove one or more containers
|
|
docker exec -it <container_name_or_ID> <command>
|
Run a command in a running container
|
|
docker logs <container_name_or_ID>
|
Fetch the logs of a container
|
|
docker-compose up
|
Start services defined in a docker-compose.yml file
|
|
docker-compose down --rmi all -v
|
Stop and remove containers, networks, images, and volumes
|
|
docker pull <image_name>:<tag>
|
Pull an image or a repository from a registry
|
|
docker tag <source_image> <target_image>
|
Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
|
|
docker push <image_name>:<tag>
|
Push an image or a repository to a registry
|
|
docker inspect <container_or_image_name_or_ID>
|
Display detailed information on one or more containers or images
|
|
docker system prune -a
|
Delete everything
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.