Docker建立自己的image

1、首先到dockerhub注册自己的账号
dockerhub

2、新建一个repository名字为justatest

3、取回debian6的镜像

docker pull debian:6

4、新建~/Docker/justatest/Dockerfile

From debian:6
RUN apt-get -y update && apt-get install -y fortunes
CMD /usr/games/fortune -a

5、创建并上传你的image

#创建image
docker build -t justatest .
#运行image
docker run justatest
#查看你的image id
docker images
#进行标记
docker tag image-id neohope/justatest:latest
#登录
docker login
#上传
docker push neohope/justatest
#下载
docker pull neohope/justatest
#运行
docker run neohope/justatest

Leave a Reply

Your email address will not be published. Required fields are marked *

*