2016-08-04 15:24:17 +02:00
|
|
|
There are some steps required to create your own docker image.
|
|
|
|
|
|
|
|
1. Have a Docker hub account, https://hub.docker.com/
|
|
|
|
2. Install docker.io package on 64 bit system.
|
|
|
|
3. Create a Dockerfile. You will find one in this directory.
|
|
|
|
4. Build the image from Dockerfile.
|
2019-04-03 14:10:56 +02:00
|
|
|
5. Login on Docker hub
|
|
|
|
6. Push the image to Docker hub.
|
|
|
|
7. Specify the image in your bitbucket-pipelines.yml file
|
2016-08-04 15:24:17 +02:00
|
|
|
|
|
|
|
1 Docker hub account
|
|
|
|
Well, sign up here =) https://hub.docker.com/
|
|
|
|
|
|
|
|
2 Install docker
|
|
|
|
sudo apt-get install docker.io
|
|
|
|
|
|
|
|
3 Create Dockerfile
|
|
|
|
Find example in this directory.
|
|
|
|
|
|
|
|
4 Build docker image
|
|
|
|
In the same directory as you have your Dockerfile, run command:
|
2019-04-03 14:10:56 +02:00
|
|
|
sudo docker build -t yourdockerusername/imagename .
|
2016-08-04 15:24:17 +02:00
|
|
|
|
2019-04-03 14:10:56 +02:00
|
|
|
5 Login on Docker hub
|
|
|
|
Before publishing you must login on Docker hub
|
|
|
|
sudo docker login
|
|
|
|
|
|
|
|
6 Push image to Docker hub
|
2016-08-04 15:24:17 +02:00
|
|
|
Run command
|
2019-04-03 14:10:56 +02:00
|
|
|
sudo docker push yourdockerusername/imagename
|
2016-08-04 15:24:17 +02:00
|
|
|
|
2019-04-03 14:10:56 +02:00
|
|
|
7 Specify the image in your bitbucket-pipelines.yml file
|
2016-08-04 15:24:17 +02:00
|
|
|
As documented here: https://confluence.atlassian.com/display/BITBUCKET/Use+Docker+images+as+build+environments+in+Bitbucket+Pipelines
|
|
|
|
|
|
|
|
You can use your image on a top level as well as on a specific step like this.
|
|
|
|
image: yourdockerusername/imagename
|