docker images
docker rmi {image_name/id}
docker rmi -f {image_name/id}
docker rmi $(docker images -f "dangling=true" -q)
docker run -d {image:tag}
-d => stands for de-attach mode
docker rename {current_container_name} {new_container_name}
docker ps -l
docker ps -a
docker rm {Container Id}
Use force `-f` To remove running container
docker rm -f {container_id}
docker start {}
docker run -d --name {container name} -p 80:80 nginx
docker run --restart always --detach --name auto-start-redis redis
To expose port use -p-
docker run -d -p {host_os_port}:{docker_port} {image:tag}
docker run -d -p 9090:80 nginx:alpine
docker stats {container_id}
docker run -d --name {container_name} --memory "200mb" nginx:alpine
[0,3] - means use oly 0 and 3. [0-3] means use 0 to 3
docker run -d --name {container_image} --memory "200mb" --cpuset-cpus 0-3 ngnix:alpine
docker commit {container_id} {imageName}:{tag_name}
Once exit from bash container will get destroy.
docker run --rm -ti ubuntu bash
docker inspect {container_id}
Use to install application
FROM ubuntu
RUN apt-get install git
Command to execute
From ubuntu
RUN apt-get install nginx
ngnixctl -DFOREGROUND
The process must be foregroud
, otherwise the docker will exit.
If there is no foreground
process then use the following command ti
(terminal) to keep alive for debug
docker run -d -ti --name {Container_name} -p {PORT:PORT} {image}
docker exec -ti {containerName} bash
docker cp {filename} {container_name}:/{destination}
docker cp thirumal.txt nginx1:/var/www/
docker cp {container_name}:/{source path} /{destination}
docker cp nginx1:/var/www/thirumal.txt .