- 创建一个能运行docker命令的基础镜像
FROM hub.deri.org.cn/library/openjdk:8-jdk-alpine
MAINTAINER wuzhiyong Docker Maintainers "wuzhiyong@deri.energy"
RUN echo "Asia/shanghai" > /etc/timezone
RUN apk add docker
ENV LANG C.UTF-8
- 创建java镜像
FROM hub.deri.org.cn/library/openjdk:8-jdk-alpine-docker
MAINTAINER wuzhiyong Docker Maintainers "wuzhiyong@deri.energy"
ADD route-1.0.0-SNAPSHOT.jar /root
EXPOSE 8080
ENV LANG C.UTF-8
CMD cd /root && java -jar route-1.0.0-SNAPSHOT.jar
- 启动容器必须携带的
-v /var/run/docker.sock:/var/run/docker.sock
这样启动起来的java容器内,可以直接执行docker命令,如docker ps
获取宿主机所有运行的容器列表.