The much awaited Docker build support on Oracle Developer Cloud Service is here. Now you will be able to build Docker images and execute Docker commands as part of the Continuous Integration and Continuous Deployment pipeline.
This blog covers the description of how and what you can do with the Docker build support on Developer Cloud Service. It will give an understanding of the Docker commands that we can run/execute on Developer Cloud as part of the build job.
Note: There will be a series of blogs following up on using Docker build on Developer Cloud covering different technology stacks and usage.
Pre-requisite to be able to run Docker commands or use Docker Build steps in the build job is that we should select a software template which has Docker included as a software bundle. Selecting the template with Docker ensures that the Build VM which gets instantiated using the selected software template has Docker runtime installed on it, as shown in the below screen shot. The template names may vary in your instance.
To know about the new build system you can read this blog link. Also you can refer the documentation on configuring the Build VM.
You will be able to verify whether Docker is part of the slected VM or not by navigating to Build -> <Build Job> -> Build Settings -> Software
You can refer this link to understand more about the new build interface on Developer Cloud.
Once you have the Build Job created with the right Software Template selected as described above, go to the Builders tab in the Build Job and click on the Add Builder. You will see Docker Builder in dropdown as shown in the screen shot below. Selecting Docker Builder would give you Docker command options which are given out of the box.
You can run all other Docker commands as well, by selecting Unix Shell Builder and writing your Docker command in it.
In the below screen shot you can see two commands selected from the Docker Builder menu.
Docker Version – This command interface prints the Docker version installed on your Build VM.
Docker Login – Using this command interface you can login and create connection with the Docker Registry. By default it is DockerHub but you can use Quay.io or any other Docker registry available over the internet. If you leave the Registry Host empty then by default it will connect to DockerHub.
Docker build – Using this command interface you can build a Docker Image in Oracle Developer Cloud. You will have to have a Dockerfile in the Git repository that you will be configuring in the Build Job. The path of the Dockerfile has to be mentioned in the Dockerfile field. In case the Dockerfile resides in the build context root, you can leave the field empty. You will have to give the image name.
Docker Push – Now to push the Docker image that you have built using Docker Build command interface to the Docker Registry. You will have to first use Docker Login to create a connection to the Docker Registry where you want to push the image. Then use the Docker Push command giving the exact name of the image built as you had given in Docker Build command.
Docker rmi – To remove the Docker images we have build.
As mentioned previously, you can run any Docker command in Developer Cloud. If the UI for the command is not given, you can use Unix Shell Builder to write and execute your Docker command.
In my follow up blog series I will using a combination of the out of the box command interface and Unix Shell Builder to execute Docker commands and get build tasks accomplished. So watch out for the upcoming blogs here.
Happy Dockering on Developer Cloud!
**The views expressed in this post are my own and do not necessarily reflect the views of Oracle