➜ docker images REPOSITORY TAG IMAGE ID CREATED SIZE liuqh/hellonde v1 db149c04d3fa 12 seconds ago 648MB laradock_nginx latest fb8945ae0cb8 11 days ago 27.6MB
1.6 运行容器
➜ docker run -d -p 8080:8080 --name hello-word liuqh/hellonde:v1 f18a619dafb3e333cd3592ce5e8e7b373d622c81fe968558307970f22cb1a92a
➜ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f18a619dafb3 liuqh/hellonde:v1 "/bin/sh -c 'node se…" 3 seconds ago Up 2 seconds 0.0.0.0:8080->8080/tcp hello-word
如果是已经存在的镜像则使用:docker tag <existing-image> <hub-user>/<repo-name>[:<tag>]
这里的不指定就是latest。
2.2 push 镜像到docker hub的仓库
# 登录 docker hub ➜ 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: liuqinghui Password: Login Succeeded
# docker push 镜像到docker hub 的仓库 ➜ docker push liuqinghui/helloword:v1 The push refers to repository [docker.io/liuqinghui/helloword] 99393065d499: Pushed 20a6f9d228c0: Mounted from library/node 80c332ac5101: Mounted from library/node 04dc8c446a38: Mounted from library/node 1050aff7cfff: Mounted from library/node 66d8e5ee400c: Mounted from library/node 2f71b45e4e25: Mounted from library/node v1: digest: sha256:b567d7fbcfe5d1987d2bd6fd8f8633f11ca32c666868cb6366a5d0ae3380a9fe size: 1794