簡介
- docker:20-dind這個鏡像實現(xiàn)了守護進程倒戏,因此進入容器后docker ps就可以使用
- 注意Dockerfile和docker run -itd都不要加cmd粹胯,否則守護進程不生效
Dockerfile
# dind
FROM docker:20-dind
WORKDIR /app
ENV TZ=Asia/Shanghai
ENV DEBIAN_FRONTEND noninteractive
RUN echo "https://mirrors.aliyun.com/alpine/latest-stable/main" > /etc/apk/repositories
RUN echo "https://mirrors.aliyun.com/alpine/latest-stable/community" >> /etc/apk/repositories
RUN apk update && apk add vim tmux lsb-release sudo git nodejs npm gcc g++ bash
COPY ./src /app/src
RUN cd /app/src/xxx && rm -rf node_modules && npm install --force && npm run build
how to use
docker build -f dind -t ubuntu:dind .
docker run -itd --privileged -p 80:80 -p 3000:3000 -p 9090:9090 -p 4000:3306 --name=dind ubuntu:dind
docker exec -it dind sh