Docker 学习记录

Dockerfile的编写

FROM hub.c.163.com/library/java:8-alpine

MAINTAINER ade zdzzyc@gmail.com

ADD target/*.jar app.jar

EXPOSE 80

ENTRYPOINT ["java","-jar","/app.jar"]

构建docker镜像

docker build -t zdzzyc/manager .

运行docker镜像

docker run -p 8762:80 -d zdzzyc/manager

推送docker镜像到远程镜像仓库

1.登录

2.标记本地镜像

docker tag 本地镜像id hub.c.163.com/zdzzyc/gaifangwang/manager(你的项目路径)

3.推送

docker push hub.c.163.com/zdzzyc/gaifangwang/manager

删除本地的镜像

docker image rm -f 63277ac44f99

如果提示如下的话就是这个镜像子啊运行中。我们要先停止一下

Error response from daemon: conflict: unable to delete 63277ac44f99 (must be forced) - image is being used by stopped container d94a64abe88b

docker stop d94a64abe88b

然后在删除就可以了

常用命令

查看正在运行的镜像 docker ps

docker启动 systemctl start docker

设置开机启动 systemctl disable docker

Loading Disqus comments...
Table of Contents