---
# System prepended metadata

title: Docker
tags: [Cathay]

---

###### tags: `Cathay`
# Docker

DOCKER
dockerHUB,
https://github.com/GoogleCloudPlatform/python-docs-samples/blob/bcb2b2748eda44ebdac4ec47c4b09570948f9815/run/pubsub/Dockerfile#L20

Steps:
1.建一個.Dockerfile 
( FROM python:3.10
ENV PYTHONUNBUFFERED True
COPY requirements.txt ./
RUN pip install -r requirements.txt )

2.產一個requirements.txt
>pip3 freeze > requirements.txt

3.buil Docker
>docker build -t py-env -f .Dockerfile .

4.查看docker 
>Docker images

5.[HackMD](https://hackmd.io/@YT1aIUH4Ss2CV4gVi5yKBQ/Sk2mIP4Li)建一個 docker-compose.yml version: '2.3'
services:
  py-env:
    container_name: py-env
    image: python:3.10-slim
    command: tail -F anything
    volumes:
      - ${PWD}:/tmp/src

6.執行docker compose up -d (dorcker compose down)

7。進入docker
docker exec -it py-env bash

------------
#### 指令

build

>podman build -f 絕對路徑/.Dockerfile -t 命名

列出所有容器 
>podman ps -a

刪除容器
> podman rm -a

