A Basic Guide on Deploying Apps to Container Service from Bitbucket

  1. Docker
  2. Bitbucket
  3. Alibaba Cloud Container Registry
  4. Alibaba Cloud Container Service
  5. Node.js
  6. Let’s Encrypt SSL/TLS


Docker is an open source software designed to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and ship it all out as one package. By doing so, thanks to the container, the developer can rest assured that the application will run on any other Linux machine regardless of any customized settings that machine might have that could differ from the machine used for writing and testing the code.


Bitbucket is a Git version control repository management solution designed for professional teams. It gives you a central place to manage git repositories, collaborate on your source code and guide you through the development flow. It allows you to create unlimited private free Repositories with up to 5 collaborators. Which makes it an optimal place to host proprietary code.

  1. Access control to restrict access to your source code.
  2. Workflow control to enforce a project or team workflow.
  3. Pull requests with in-line commenting for collaboration on code review.
  4. Jira integration for full development traceability.
  5. Full Rest API to build features custom to your workflow if they are not already available from their Marketplace

Alibaba Cloud Container Registry

Alibaba Cloud Container Registry (ACR) is a secure image hosting platform that provides containerized image lifecycle management. With ACR, you have full control over your stored images. ACR has a number of features, including integration with GitHub, Bitbucket etc. It can also automatically build new images after the compile and test from source code to applications. This service simplifies the creation and maintenance of the image registry and supports image management in multiple regions. Combined with other cloud services such as Container Service, Container Registry provides an optimized solution for using Docker in the cloud.

Alibaba Cloud Container Service

Alibaba Cloud Container Service (ACS) is a high-performance and scalable container application management service that enables you to use Docker and Kubernetes to manage the lifecycle of containerized applications.


Node.js is an asynchronous event driven JavaScript runtime environment. It is designed to build scalable network applications. The Node run-time environment includes everything you need to execute a program written in JavaScript on your machine as a standalone application. Node.js run on the V8 JavaScript runtime engine. This engine takes your JavaScript code and converts it into a faster machine code. Machine code is low-level code which the computer can run without needing to first interpret it.

Let’s Encrypt SSL/TLS

Let’s Encrypt is a global Certificate Authority (CA). They let people and organizations around the world obtain, renew, and manage SSL/TLS certificates. These certificates can be used by websites to enable secure HTTPS connections. Let’s Encrypt only offers Domain Validation (DV) certificates. They do not charge a fee for these certificates. Let’s Encrypt is a nonprofit, with a mission to create a more secure and privacy-respecting Web by promoting the widespread adoption of HTTPS. Their services are free and easy to use so that any website can deploy HTTPS.


To begin with, we will be creating a private repository for our Application’s code on Bitbucket, so for that you must have a Bitbucket account. If you don’t have one then you can sign up for an account.

Part I: Adding Our App into the Bitbucket Git Repository

In this section, we’ll be creating the Bitbucket Git Repository and adding our application and Docker configurations in it.

Step 1: Creating the Bitbucket Repository

First, login to your Bitbucket account and click on the “+” button located in the left menu bar, and then from the options select “Repository”, and then in the “Create a new repository” form, provide the name for the Repository. And then press the “Create Repository button”.

Step 2: Adding the Application and Docker files into the Repository

Now that we have successfully created the Repository, we start by adding the files for our Application and Docker into that Repository.

const http = require('http');
const hostname = '';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World\n');
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
# Use Node version 10.15.1
FROM node:10.15.1
# Create a directory where our app will be placed
RUN mkdir -p /usr/src/app
# Change directory so that our commands run inside this new directory
WORKDIR /usr/src/app
# Get all the code needed to run the app
COPY . /usr/src/app
# Expose the port the app runs in
# Serve the app
CMD node app.js
git add .
git commit -m "app.js and dockerfile added"
git remote add origin https://your-username@bitbucket.org/your-username/the-repo-name.git
git push -u origin master

Part II: Integrating Bitbucket with ACR

The first thing you need to do is to activate the Alibaba Cloud Container Registry. It can be found under the “Elastic Computing” section on your Alibaba Cloud Console.

Part III: Deploying the Application

To begin, we will need to create a VPC, to do that simply navigate to the Virtual Private Cloud under Networking. This will take you to the VPC console, where you click on the “Create VPC” button to create the VPC and VSwitch. After clicking the button you will be presented with a small form to select the options for your new VPC, we will use the default settings for the most part and just enter names, and then click “OK” button to continue.

Part IV: Securing Our Application with Let’s Encrypt SSL/TLS

To get started with this, you should first go through this guide by John Hanley on configuring Let’s Encrypt ACME on Alibaba Cloud. Now once you have configured everything and have created the Certificate files, proceed to follow the aforementioned steps.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com