在Github上創建項目倉庫
和創建其他Github項目一樣,在Github創建一個倉庫,然後在倉庫裡面增加一個dockerfile,然後提交併推送到Github上。
Dockerfile內容如下:
#FROM - Image to start building on.
FROM ubuntu:14.04
#MAINTAINER - Identifies the maintainer of the dockerfile.
MAINTAINER [email protected]
#RUN - Runs a command in the container
RUN echo "Hello World" > /root/hello_world.txt
#CMD - Identifies the command that should be used by default when running the image as a container.
CMD ["cat", "/root/hello_world.txt"]
在Docker Hub上構建工作流
步驟1:註冊Dockerhub並登錄。
步驟2:基於Github倉庫創建自動化構建
選擇Github
步驟3:查看Build Settings
步驟4:查看Build Details
構建和迭代我們的項目
本地修改Dockerfile文件,提交併推動到Github上。
驗證上述發生的變化。
獲取鏡像,並運行,查看內容是否變化。
docker pull bage88/simple-dockerfile
運行Docker鏡像
docker run
因為Docker Hub訪問速度問題,而且企業內部開發的代碼都需要打包成私有的鏡像。所以Docker Hub適合開源的小型項目。
對於企業內部來說,可以使用國內雲計算廠商提供的鏡像服務,也可以在企業內部搭建。
相關推薦
'Windows10下安裝Docker'
"前言Docker幾年前就比較火的概念,而現在,Docker在開發中慢慢的普及開來,不管你是研發還是測試,還是運維人員都或多或少的知道"容器[container]"的概念,並且現在CICD的概念也是越發的普及,解放運維,解放研發,好處自然多的不用說我們作為一個普通研發,...
Docker
Windows 10
Windows
Redis
GitHub
VMware
虛擬機
軟件
VirtualBox
Ubuntu
CentOS
ElasticSearch
MySQL
電腦
2019-09-16
'Go Web 框架 Gin 實踐9—將Golang應用部署到Docker'
"Go語言中文網,致力於每日分享編碼知識,歡迎關注我,每天一起進步!項目地址:https://github.com/EDDYCJY/go-gin-example注:開始前你需要安裝好 docker,配好鏡像源本章節源碼在 f-20180324-docker 分支上從本章節開...
Docker
2019-08-28
'springboot配合maven打成可執行jar,構建鏡像部署到docker容器中'
"本篇文章將介紹springboot應用如何打成jar包,並將jar構建為docker鏡像部署到docker中應用打包需要配合spring-boot-maven-plugin打包,將以下代碼放到應用pom文件中 <plugin> <groupId>o...
推薦中...