docker build —platform=linux/amd64 -t tag_name
docker images
docker rmi
또는 docker image rm
docker login -u userID -p PW
docker pull accountID/image_name
docker push accountID/image_name
docker create
docker run —name -p -v image_name
docker ps
docker start container_id
docker kill
docker rm
docker logs -f container_id
(—tail 옵션사용가능)docker exec container_id <명령어>
docker run -d image_name
: Docker Container가 실행되었다가 중단되면 데이터가 사라진다. → 데이터의 유지를 원한다면 Volume이 필요하다.
: docker run -v를 실행할 때 지정된다.
docker run -v host_file_sys_path:container_file_sys_path
dockr run -v path
docker run -v name:path
name:path:ro
docker run -d —name=nginx -p 8081:80 nginx
(8081포트로 열기)docker exec —user=root -it nginx sh
docker restart nginx
)FROM nginx:latest
RUN echo "<h1>test volume</h1>" > /user/share/nginx/html/index.html
docker run -p 8081:80 —name nginx -v local_path:/usr/share/nginx/html nginx
volumes:
- ${AIRFLOW_PROJ_DIR:-.}/dags:/opt/airflow/dags
docker volume ls
docker volume rm
docker volume prune
docker volume inspect
: 실행중인 컨테이너가 없어야 이미지 삭제가 가능하다.
docker container rm
을 이용해서 한개~다수의 컨테이너 삭제 가능docker container -rm -f $(docker container ls -aq)
로 모두 삭제 가능 (-aq를 이용하면 containerID만 가져오기가 가능하다.)docker image rm
docker image rm -f $(docker image ls -q)
docker ps
docker images
이미지 출처 : https://github.com/dockersamples/example-voting-app
docker build -t vote ./vote
docker build -t result ./result
docker build -t worker ./worker
: docker network create
docker container rm -f $(docker container ls -aq)
docker network create mynetwork
docker run -d —name=redis —network mynetwork redis
docker run -d —name=db -e POSTGRES_PASSWORD=password —network mynetwork postgres
docker run -d —name=vote -p 5001:80 --network mynetwork vote
docker run -d --name=result -p 5002:80 --network mynetwork result
docker run -d --name=worker --network mynetwork worker