创建docker file
# Use an official node.js LTS version
FROM node:boron
# set http.sslverify false
RUN git config --global http.sslverify false
# create work dir
RUN mkdir /app
# set work dir
WORKDIR /app
# clone from repo
RUN git clone https://username:password@git.repo/repo.git
# set work dir
WORKDIR /app/repo
# npm i
RUN npm i -d
# set NODE_ENV=production
ENV NODE_ENV=production
# Bundle app source
# also you can install pm2 ,and use pm2 start app
CMD [ "node", "." ]
# use user node
USER node
docker build
sudo docker build --no-cache -t tag_name
--no-cache 不要使用缓存
推送到docker仓库
- 在推送之前应该打上标签 仓库地址/名称
sudo docker tag xxxxxxxxx 127.0.0.1:5000/test:version1.0
- 推送
sudo docker push 127.0.0.1:5000/test:version1.0
- 查看
- 通过
http
查看
wget '127.0.0.1:5000/v2/_catalog'
搭建私有仓库
这个直接看官网的就可以的 但是要注意的是 registry2默认的是https
要修改一下 /etc/docker/daemon.json
这个文件 加上 [这个文件没有就创建 不过要注意是json格式的]
"insecure-registries" : ["myregistrydomain.com:5000"],
网友评论