Docker
Tutorials
Learning
Dockerfile Best Practices
-
Best practices for writing Dockerfiles | Docker Documentation
-
Speed Up Your Development Flow With These Dockerfile Best Practices | Docker
How-Tos
- Run x86 Docker containers with Rosetta on Mac | Level Up Coding ⇒ 影響套件: geopandas, pillow Feb 9, 2023
start docker service
install docker compose (if compose not in default command)
get latest version script
sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# verify
docker-compose version
make docker autostart
$-> sudo chkconfig docker on
I strongly recommend install also: git (sudo yum install -y git)
$-> sudo reboot # only if for you it is neccesary
ARG & ENV
FROM
之前的ARG只有用在FROM那一句,FROM之後就會是空白,所以如果要使用ARG或ENV就還要再FROM之後宣告一次,ARG只存在build image,ENV存在build & run time。
ARG POSTGRES_VERSION
ARG DEBIAN_RELEASE
FROM postgres:${POSTGRES_VERSION}-${DEBIAN_RELEASE}
ARG POSTGRES_VERSION
RUN echo ${POSTGRES_VERSION}
Python
python-env-series Archives | Docker
-
multi stage (builder & slim)
-
docker compose
-
network seperation: frontend & backend
-
secrets (db-password)
-
-
part3: visual studio code debug (pvsd)
Useful commands
Build image by Dockerfile
Run image
xxx build --force-rm --no-cache && xx up -d