docker login Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. Username (qinjiangbo): qinjiangbo Password: Login Succeeded
RUN chmod 755 idea -R RUN chmod 755 docker-entrypoint.sh
EXPOSE 1017
WORKDIR /idea
CMD ["/docker-entrypoint.sh"]
这个内容就不解释了,不明白的可以看我前面的关于Docker的几篇文章。
docker-entrypoint.sh
1 2
#!/bin/bash ./IntelliJIDEALicenseServer_linux_386
打包制作镜像
制作镜像的命令比较简单:
1
$ docker build -t license-server:latest .
注意最后有一个.
查看镜像列表:
1 2 3 4 5 6 7 8
$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE license-server latest 34fe7d26dd9e 4 hours ago 118MB ubuntu latest 00fd29ccc6f1 3 weeks ago 111MB sshd_centos latest f0560ea85754 2 months ago 221MB nginx latest 1e5ab59102ce 2 months ago 108MB gitlab/gitlab-ce latest 453d64ae84c7 3 months ago 1.28GB centos latest 196e0ce0c9fb 3 months ago 197MB
已经存在这个镜像了,接下来需要给这个镜像打标,示例就是docker tag <existing-image> <hub-user>/<repo-name>[:<tag>],因此我们这样操作:
1
$ docker tag 34fe7d26dd9e qinjiangbo/idea-license-server
再次查看可以看到列表中多了一个:
1 2 3 4 5 6 7 8 9
$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE license-server latest 34fe7d26dd9e About an hour ago 118MB qinjiangbo/license-server latest 34fe7d26dd9e About an hour ago 118MB ubuntu latest 00fd29ccc6f1 3 weeks ago 111MB sshd_centos latest f0560ea85754 2 months ago 221MB nginx latest 1e5ab59102ce 2 months ago 108MB gitlab/gitlab-ce latest 453d64ae84c7 3 months ago 1.28GB centos latest 196e0ce0c9fb 3 months ago 197MB
$ docker push qinjiangbo/idea-license-server:latest The push refers to a repository [docker.io/qinjiangbo/idea-license-server] Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.65.1:53: read udp 192.168.65.2:56209->192.168.65.1:53: i/o timeout