sudo apt remove docker docker-engine docker.io containerd runc
sudo apt update && sudo apt install ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update && sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo usermod -aG docker ${USER}
su - ${USER}
View running containers:
docker ps
List local images/networks/containers:
docker image ls
docker network ls
docker container ls
Container resource usage:
docker stats
docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container_name_or_id
Clean system (stopped containers, networks, images, build cache). Run with -a to clean everything not currently attached to a running container.
docker system prune (-a -f)
Clean images/network/container only. Run with -a to clean everything not currently running.
docker image prune (-a -f)
docker network prune (-a -f)
docker container prune
docker volume prune
Move into the shell of a container (line 1 for shell
(Alpine), line 2 for bash
(Debian/Ubuntu)). The -i
flag gives us “interactive” access to the container, the -t
flag gives us that through a terminal.
docker exec -it <container_name> sh
docker exec -it <container_name> bash
Import a database (mark the absence of the t flag as we don’t want/need an actual terminal).
docker exec -i <container_name> mysql -u <db_user> -p'<db_password>' <db_name> < abc.sql
See a container log. The -f
flag keeps the log open and displays new entries as they come in. --tail 50
only shows the last 50 lines initially. This prevents a potential long wait before you reach the last lines.
docker logs -f --tail 50 <container_name>
When you have a dockerfile you can build it directly:
docker build .
But preferably you give it a name:
docker build -t <yourusername>/<repository-name> .
For example:
docker build -t jodibooks/teamcity-agent .
Or when using Sonatype Nexus as your private repository:
docker build -t sonatype.jodibooks.com/jodibooks/teamcity-agent .
An image gets the latest
label by default. Every time you build it anew, it will overwrite the previous latest
image. To distinguish versions, images can, and should, be tagged:
docker tag <yourusername>/<repository-name>:latest <yourusername>/<repository-name>:2021.1.4-linux-sudo
For example:
docker tag jodibooks/teamcity-agent:latest jodibooks/teamcity-agent:2021.1.4-linux-sudo
Or when using Sonatype Nexus as your private repository:
docker tag sonatype.jodibooks.com/jodibooks/teamcity-agent:latest sonatype.jodibooks.com/jodibooks/teamcity-agent:2021.1.4-linux-sudo
To check the size, name and tags of the image run:
docker images
docker run <image>
You can specify the image by it’s REPOSITORY
or (the start of the) IMAGE ID
. Add -d
flag to run the container in the background. Or use -i
for interactive mode with -t
for a terminal. For example:
docker run jodibooks/teamcity-agent -d
Or
docker run 3120 -it
If you need more, for example a linked port, check the Docker CLI documentation.
docker stop <REPOSITORY>
Or
docker stop <IMAGE_ID>
docker login sonatype.jodibooks.com
docker push sonatype.jodibooks.com/jodibooks/teamcity-agent:2021.1.4-linux-sudo
docker login sonatype.jodibooks.com
docker pull sonatype.jodibooks.com/jodibooks/teamcity-agent:2021.1.4-linux-sudo
Browse to the folder containing the docker-compose.yml file and run:
docker-compose up -d
If you're to lazy to browse first:
docker-compose up -d ~/teamcity/docker-compose.yml
The -d
flag runs the dockers in the background. If you need more, check the Docker-compose CLI documentation.
Browse to the folder containing the docker-compose.yml file and run:
docker-compose down
If you're to lazy to browse first:
docker-compose down ~/teamcity/docker-compose.yml
If you updated one or more containers, you can update those by running:
docker-compose up -d
If you're to lazy to browse first:
docker-compose up -d ~/teamcity/docker-compose.yml
Yes, this is the same command as running the container assembly from scratch. This prevents all the other running (non-changed) from rebooting and thus disconnecting.
If you updated the compose file or settings for one or more containers, you can apply those by running:
docker-compose up -d --force-recreate
If you're to lazy to browse first:
docker-compose up -d --force-recreate ~/teamcity/docker-compose.yml
First try updating as mentioned above. If that doesn’t work or you really want to restart all containers, run:
docker-compose restart
If you're to lazy to browse first:
docker-compose restart ~/teamcity/docker-compose.yml
https://docs.docker.com/engine/reference/builder/
# start from official docker image
FROM jetbrains/teamcity-agent:2021.2-linux-sudo
# add a maintainer
LABEL maintainer="jodiBooks <mail@jodibooks.com>"
# set user to root if necessary
USER root
# Install dependencies and cleanup after
RUN set -x && \
apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends ca-certificates curl git gnupg unzip nano rsync && \
apt-get clean && \
apt-get autoremove && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/* /tmp/*
# Install node 14.x LTS and cleanup after
RUN set -x && \
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y --no-install-recommends nodejs && \
apt-get clean && \
apt-get autoremove && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/* /tmp/*
# Add Yarn 1.22.x and cleanup after
RUN set -x && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update -y && \
apt-get install --no-install-recommends -y yarn && \
apt-get clean && \
apt-get autoremove && \
rm -rf /var/lib/apt/lists/* /var/cache/apt/* /tmp/*
# Add AWS CLI and cleanup after
RUN set -x && \
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
rm -r aws awscliv2.zip
https://docs.docker.com/compose/compose-file/
In your AWS account create:
a policy SES-sendmail-alerts
:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ses:SendEmail",
"ses:SendRawEmail"
],
"Resource": "arn:aws:ses:eu-central-1:<your account id>:identity/*"
}
]
}
a user joeplaa.com: ses-user.alerts
with policy SES-sendmail-alerts
attached
Create a docker-compose.yml
file:
version: "3"
services:
joeplaa_mailer:
container_name: joeplaa_mailer
image: blueimp/aws-smtp-relay:latest
restart: unless-stopped
environment:
AWS_REGION: eu-central-1
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
ports:
- '1025:1025'
Create a .env
file with the credentials of the joeplaa.com: ses-user.alerts
user:
AWS_ACCESS_KEY_ID=<ses-user.alerts access_key_id>
AWS_SECRET_ACCESS_KEY=<ses-user.alerts secret_access_key>
Create file docker-compose.yml
:
version: "3"
services:
teamcity-server:
container_name: teamcity-server
image: jetbrains/teamcity-server:2021.2-linux
restart: unless-stopped
user: root
depends_on:
- mariadb
ports:
- 8111:8111
volumes:
- ./teamcity/data:/data/teamcity_server/datadir
- ./teamcity/log:/opt/teamcity/logs
networks:
- app-network
teamcity-agent1:
container_name: teamcity-agent1
image: jetbrains/teamcity-agent:2021.2-linux-sudo
restart: unless-stopped
environment:
SERVER_URL: http://teamcity-server:8111
AGENT_NAME: jodiTeamcityAgent1
DOCKER_IN_DOCKER: start
volumes:
- ./docker:/var/lib/docker
- /root/.aws:/root/.aws
privileged: true
networks:
- app-network
mariadb:
container_name: mariadb
hostname: mariadb
image: mariadb:10.4-focal
restart: unless-stopped
volumes:
- ./mariadb/data:/var/lib/mysql
- ./mariadb/log:/var/log/mysql
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: teamcity
MYSQL_USER: ${TEAMCITY_DB_USER}
MYSQL_PASSWORD: ${TEAMCITY_DB_PASSWORD}
networks:
- app-network
Create file .env
to store environment variables:
MYSQL_ROOT_PASSWORD=<strong_password>
TEAMCITY_DB_USER=<user_name>
TEAMCITY_DB_PASSWORD=<strong_password>
Create file docker-compose.yml
:
version: "3"
services:
theta-edge-node:
container_name: theta-edge-node
image: thetalabsorg/edgelauncher_mainnet:v1.0.0
restart: unless-stopped
environment:
EDGELAUNCHER_CONFIG_PATH: /edgelauncher/data/mainnet
PASSWORD: ${PASSWORD}
ports:
- '15888:15888'
- '17888:17888'
volumes:
- ~/.edgelauncher:/edgelauncher/data/mainnet
Create file .env
to store environment variables:
PASSWORD=strong password here