Docker container building script on Ubuntu 20.04


At first

Describes a script for building Docker containers in Ubuntu20.04.

The script you are using is published as vm-configure on github, so please download it from github or download it from here.

See the link below for the vm-configure folder configuration.


This is a script for launching Docker containers.

The location of the script file is in the current directory.

SCRIPT_DIR=$(dirname "$0")

The docker directory with the docker-compose.yml file is the current directory.

cd "docker"

/guest-share/ubuntu-20.04/docker/ENV File Based on what is defined in the file, we have created and re-loaded the environment variable definition file “.env” that can be used in “docker-compose.yml”.

In the sample, the persistence path of the Docker container volume is based on the execution location of the script, and the base URL of the site is stored in the “.env” file as the Ubuntu host name.

sed -e "s|\[VOLUME_HOME\]|$(cd "../../" && pwd)/docker-volumes|g" \
	-e "s|\[HOST_NAME\]|$(hostname)|g" "ENV" > ".env"
. ".env"

Creating a directory by reading the path to persist the volume of the Docker container from the .env file.

while read line
	if [[ ${line} =~ ^VOLUME_.*$ ]]; then
		mkdir -p "${dirName}"
done < ".env"

The owner and ownership group of the directory where the Jenkins container volume is stored has been changed to uid1000.

Because the Jenkins container is running on UID1000, if the owner UID of the directory where the volume is stored is anything other than 1000, an error occurs because you do not have access rights.To prevent this error, the UID of the owner of the directory has been changed to 1000.

chown -R 1000:1000 "${VOLUME_JENKINS_HOME}"

Launch the Docker container based on the configuration of the container described in docker-compose.yml in the current directory.

The-d parameter specifies that the Docker container should run in a different process than the terminal.If you do not specify any parameters, the command will not exit until the Docker container is finished.

docker-compose up -d


This is the file that is the source of the environment variable file.env used by docker-compose.yml.

Defines the base URL.

[HOST_NAME]is replaced with the host name set to Ubuntu in and saved in the .env file.


Defines the seed value to be set for containers that require a password seed.


Defines the directory to which the container’s volume is persisted.

[VOLUME_HOME]is replaced with the execution directory of the script in and saved in the .env file.



docker-compose.yml is a file for Docker Compose to describe the configuration of a container.

Specifying the version of the file format of the docker-compose.yml file.

version: '3.8'

Defines the service.

In the sample, jenkins, growi, growi-mongodb, growi-elasticsearch, growi-redis, and growi-plantuml are defined as services.


Defines the configuration of the Jenkins container.

The image specifies that Docker Hub jenkins/jenkins should be used.

container_name, the name of the container is specified in jnmins.

Ports map port numbers 8080 and 9000 on the container to Ubuntu port numbers 8080 and 9000 so that you can access Jonmins from the outside with port numbers 8080 and 9000.

Volumes mounts the container’s “/var/jenkins_home” directory jenkins_home the container.

In restart, it is set to start the container automatically when Docker starts.

    image: jenkins/jenkins
    container_name: jenkins
      - '8080:8080'
      - '9000:9000'
      - 'jenkins_home:/var/jenkins_home'
    restart: always

Defines the configuration of the Growi container.

The image specifies that Docker Hub wseek/growi should be used.

container_name, the name of the container is specified as growi.

Ports map the port number 3000 on the container to Ubuntu port number 80 so that you can access The Growi with port number 80 from the outside.

depends_on, you specify the services that have dependencies on the growi service and set the order in which the containers are started.

Environment is setting the environment variables for the Growi container.

Volumes mounts the container’s /data directory growi_data the container.

Setting restart to always sets the container to start automatically when Docker starts.

    image: weseek/growi
    container_name: growi
      - 80:3000
      - growi-mongodb
      - growi-elasticsearch
      - growi-redis
      - growi-plantuml
      - BASE_URL=${BASE_URL}
      - MONGO_URI=mongodb://growi-mongodb:27017/growi
      - ELASTICSEARCH_URI=http://growi-elasticsearch:9200/growi
      - REDIS_URL=redis://growi-redis:6379/growi
      - MATHJAX=1
      - PLANTUML_URI=//growi-plantuml:8080
      - FILE_UPLOAD=local
      - growi_data:/data
    restart: always

Defines the volume on which the container will be mounted.