-
包含應用程式及其所有依賴的檔案系統快照。
-
容器啟動時的執行命令。
umermansoor:dockerprj$ touch Dockerfile
# Use Alpine Linux rootfs tarball to base our image on
FROM alpine:3.9
# Set the working directory to be '/home'
WORKDIR '/home'
# Setup our application on container's file system
RUN wget http://www.cs.cmu.edu/afs/cs/academic/class/15213-s00/www/class28/tiny.c \
&& apk add build-base \
&& gcc tiny.c -o tiny \
&& echo 'Hello World' >> index.html
# Start the web server. This is container's entry point
CMD ["./tiny", "8082"]
# Expose port 8082
EXPOSE 8082
umermansoor:dockerprj$ docker build -t codeahoydocker .
Successfully tagged codeahoydocker:latest
-
檔案系統快照(Alpine Linux 和 我們安裝的 Web 服務)
-
啟動命令(./tiny 8092)
umermansoor:dockerprj$ docker run -p 8082:8082 codeahoydocker:latest
-
https://docs.docker.com/install/
-
https://docs.docker.com/get-started/#images-and-containers
朋友會在“發現-看一看”看到你“在看”的內容