Docker Tips#
Docker#
-
Remove all exited containers
-
Before deployment, ensure that Docker's configuration file
/etc/docker/daemon.json
is ready, including mirror site, log rotation and many other useful settings.
Dockerfile#
Init Alpine Container#
# Add a mirror site
RUN sed -i 's@dl-cdn.alpinelinux.org@mirrors.aliyun.com@g' /etc/apk/repositories
# Change TimeZone
RUN apk update \
&& apk add --no-cache tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& apk del tzdata
# Change the pip mirror
RUN pip3 config set global.index-url https://mirrors.aliyun.com/simple
RUN pip3 install --upgrade pip3