How to upgrade JDK in Docker compose TeamCity container? Follow
I have this docker-compose.yml
configuration file for TeamCity - server and agent.
version: "3.5"
services:
server:
image: jetbrains/teamcity-server:latest
container_name: teamcity_server
networks:
- teamcity_network
ports:
- "8111:8111"
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- datadir:/data/teamcity_server/datadir
- logs:/opt/teamcity/logs
environment:
TEAMCITY_SERVER_MEM_OPTS: -Xmx1024m
agent:
image: jetbrains/teamcity-agent:latest
container_name: teamcity_agent
volumes:
- agent_conf:/data/teamcity_agent/conf
environment:
- SERVER_URL=http://example.com:8111
networks:
teamcity_network:
volumes:
datadir:
logs:
agent_conf:
TeamCity server and agent start correctly, I can login, create projects, connect to Git repository etc.
But my Java application needs Java 17, and TeamCity docker images provide Java 11. I tried to do upgrade, and logged in into docker Ubuntu docker exec -it <mycontainerId> bash
but I am user and I have no system privileges to update Java in the container.
Question: How can I install Java 17 into container and replace Java 11 to Java 17? Or is there configuration option for docker-compose.yml
to install Java 17 instead of 11?
Please sign in to leave a comment.
Hi,
It is not possible to replace the provided Java 11 with Java 17, as the Build Agent still requires Java 11. However, you can certainly customize the Docker image to have both Java 11 and 17. There are several ways to configure which Java the Build Agent will run on, please refer to Path to Java on Agent Machine for details on how to configure the Build Agent Java.
With Java 17 installed on the Build Agent, you'll be able to use Java 17 in your builds, even though the Build Agent is running on Java 11.
You can customize the image via the usual Docker procedure ( from the official Docker Hub page ):
Change whatever you need
Exit and create a new image from the container: