标签:iat run file inter context success agg roo images
cat > /usr/local/docker/myshop/index.jsp <<‘EOF‘
Hello World !
EOF
mkdir -p /usr/local/docker/myshop
cat > /usr/local/docker/myshop/Dockerfile <<‘EOF‘
FROM tomcat:latest
# 创建文件夹
RUN mkdir /usr/local/tomcat/webapps/ROOT
# 复制文件
COPY index.jsp /usr/local/tomcat/webapps/ROOT
EOF
[root@Proxy myshop]# docker build -t myshop .
Sending build context to Docker daemon 3.072kB
Step 1/3 : FROM tomcat:latest
---> 31a47677561a
Step 2/3 : RUN mkdir /usr/local/tomcat/webapps/ROOT
---> Running in 78de34ca9ae8
Removing intermediate container 78de34ca9ae8
---> 7fdc8ab7508e
Step 3/3 : COPY index.jsp /usr/local/tomcat/webapps/ROOT
---> 5eba0cd03308
Successfully built 5eba0cd03308
Successfully tagged myshop:latest
[root@Proxy myshop]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
myshop latest 2b6a97a4c5be 56 seconds ago 529MB
[root@Proxy myshop]# docker run -p 8080:8080 -d myshop
42111bdab34e172a777fde5d310ed5f251c09bff46c400fbf3f5b929d2321f1c
在当前目录下打包给docker进程,需要将所有待打包文件放置在此路径下
[root@Proxy myshop]# tree
.
├── Dockerfile
└── pages
└── index.jsp
1 directory, 2 files
[root@Proxy myshop]# cat > /usr/local/docker/myshop/Dockerfile <<‘EOF‘
FROM tomcat:latest
# 创建文件夹
RUN mkdir /usr/local/tomcat/webapps/ROOT
# 复制文件
COPY pages/index.jsp /usr/local/tomcat/webapps/ROOT
EOF
[root@Proxy myshop]# docker build -t myshop .
Sending build context to Docker daemon 3.584kB
Step 1/3 : FROM tomcat:latest
---> 31a47677561a
Step 2/3 : RUN mkdir /usr/local/tomcat/webapps/ROOT
---> Using cache
---> 6acd843144d1
Step 3/3 : COPY pages/index.jsp /usr/local/tomcat/webapps/ROOT
---> 790739f2e70f
Successfully built 790739f2e70f
Successfully tagged myshop:latest
标签:iat run file inter context success agg roo images
原文地址:https://www.cnblogs.com/leoshi/p/12740014.html