How to build CloudStack using Docker


I built CloudStack to understand CloudStack, but I stumbled a bit at that time, so I decided to write this article. There are various ways to build CloudStack, but this time we will use Docker.

Development environment

MacBook Pro (Mojave 10.14.6) Docker (19.03.13) docker-compose (1.27.4)

What is CloudStack Simulator?

The CloudStack simulator is a Docker image officially provided by CloudStack. The simulator is running in one container except for the management DB. (Since I am not familiar with CloudStack, I would appreciate it if you could point out any mistakes.)

Since the image of the simulator is registered in Docker Hub, we will use it this time.

I actually moved it

docker pull cloudstack/simulator
docker run --name cloudstack -d -p 8080:8080 cloudstack/simulator

I tried to run it as officially and tried to access http: // localhost: 8080 / client, but an error occurred as shown in the image below. スクリーンショット 2020-10-22 2.55.40.png I didn't know what was happening just by looking at this, so I decided to check what kind of error was occurring.

docker run --name cloudstack -p 8080:8080 cloudstack/simulator

ERROR [c.c.u.d.Merovingian2](main:null) (logid:) Unable to get a new db connection
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.

At first glance, it seems that you can't connect to MySQL? So, when I looked it up, I found issue regarding the above error.

However, since the issue was closed, I thought that the image of Docker Hub was old, so I decided to build it from the Latest release.

The main subject from here

So, I will use Latest release of official repository. Files related to Docker are under tools / docker.

** Please clone as it is because you need files other than Docker related files at build time. ** **

Run Docker-compose. Probably, by executing this command, the management DB of CloudStack is started.

docker-compose -f tools/docker/docker-compose.yml up -d

Next, build the image from the Dockerfile, but if it is the cloned Dcokerfile, a pip error will occur, so fix it.


# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
# CloudStack-simulator build

FROM ubuntu:16.04

MAINTAINER "Apache CloudStack" <[email protected]>
LABEL Vendor="" License="ApacheV2" Version=""

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get -y update && apt-get install -y \
    genisoimage \
    libffi-dev \
    libssl-dev \
    git \
    sudo \
    ipmitool \
    maven \
    openjdk-8-jdk \
    python-dev \
    python-setuptools \
    python-pip \
    python-mysql.connector \

RUN apt-get install -qqy mysql-server && \
    apt-get clean all && \
    mkdir /var/run/mysqld; \
    chown mysql /var/run/mysqld


COPY tools/docker/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY . ./root
RUN ls

RUN mvn -Pdeveloper -Dsimulator -DskipTests clean install

#Please add this line
RUN pip install --upgrade pip

RUN find /var/lib/mysql -type f -exec touch {} \; && \
    (/usr/bin/mysqld_safe &) && \
    sleep 5; \
    mvn -Pdeveloper -pl developer -Ddeploydb; \
    mvn -Pdeveloper -pl developer -Ddeploydb-simulator; \
    MARVIN_FILE=`find /root/tools/marvin/dist/ -name "Marvin*.tar.gz"`; \
    pip install $MARVIN_FILE

VOLUME /var/lib/mysql

EXPOSE 8080 8096

CMD ["/usr/bin/supervisord"]

To make the image easier to understand, specify the same tag name as the CloudStack version and build it. If you can launch the container using the built image and access http: // localhost: 8080 / client, it is successful. It takes a long time to start up, so you may want to remove the -d option if you want to check if it is working properly.

docker build -t cloudstack/simulator: . -f tools/docker/Dockerfile 
docker run --name cloudstack -d -p 8080:8080 cloudstack/simulator:

This is the screen when you can access it. スクリーンショット 2020-10-22 9.42.00.png


I introduced it briefly in the article, but due to the lack of references, I made a lot of trial and error. I hope this article helps someone who is as stumbling as I am.

Recommended Posts

How to build CloudStack using Docker
How to build Rails 6 environment with Docker
How to install Docker
How to build android-midi-lib
[Rails] How to build an environment with Docker
How to build a Ruby on Rails environment using Docker (for Docker beginners)
multi-project docker build using jib
How to authorize using graphql-ruby
[Road _node.js_1-1] Road to build Node.js Express MySQL environment using Docker
How to build Docker + Springboot app (for basic learning)
How to figure out how much disk Docker is using
How to build docker environment with Gradle for intelliJ
Try to build a Java development environment using Docker
I tried to build an environment using Docker (beginner)
How to build [TypeScript + Vue + Express + MySQL] environment with Docker ~ Express ~
I tried to build the environment little by little using docker
[Artifactory] How to use Docker repository
How to build vim on Ubuntu 20.04
How to start Camunda with Docker
How to build [TypeScript + Vue + Express + MySQL] environment with Docker ~ MySQL edition ~
How to build Rails + Vue + MySQL environment with Docker [2020/09 latest version]
How to build [TypeScript + Vue + Express + MySQL] environment with Docker ~ Sequelize ~
How to execute a contract using web3j
How to sort a List using Comparator
How to share files with Docker Toolbox
[Rails] How to upload images using Carrierwave
[Rails] How to use rails console with docker
[Java] How to calculate age using LocalDate
Don't know how to build task'credentials: edit'
How to use Docker in VSCode DevContainer
How to build SquashTM and how to support Japanese
Quick build maven project using maven docker container
Build an authentication proxy server using Docker
Docker container build fails to install php-radis
[Swift5] How to implement animation using "lottie-ios"
How to make asynchronous pagenations using Kaminari
Understand in 5 minutes !! How to use Docker
Note: [Docker] How to start and stop
How to run Blazor (C #) with Docker
How to insert icons using Font awesome
How to build an environment for any version of Ruby using rbenv
How to build a Ruby on Rails development environment with Docker (Rails 6.x)
How to build a Ruby on Rails development environment with Docker (Rails 5.x)
How to output Excel and PDF using Excella
How to check the logs in the Docker container
How to execute and mock methods using JUnit
[Rails] How to create a graph using lazy_high_charts
How to get a heapdump from a Docker container
How to make Spring Boot Docker Image smaller
How to delete a controller etc. using a command
How to play audio and music using javascript
Build a Kotlin app using OpenJDK's Docker container
[Ethereum] How to execute a contract using web3j-Part 2-
How to implement the breadcrumb function using gretel
How to update pre-built files in docker container
How to generate a primary key using @GeneratedValue
How to build API with GraphQL and Rails
How to use docker compose with NVIDIA Jetson
How to create hierarchical category data using ancestry
How to link images using FactoryBot Active Storage
How to use nginx-ingress-controller with Docker for Mac