I am attempting to use to build a Spring Cloud application that utilizes a repository hosted on GitLab to store configuration details. I can run it on my local machine. However, I am struggling to place it in a container due to the need for SSH keys. For example, my application.properties files for the configuration server:
server.port=8888
spring.cloud.config.server.git.uri=git@gitlab.com:repo
I have referenced this StackOverflow question; however, I am using a docker-compose file.
# Use postgres/example user/password credentials
version: '3.2'
services:
db:
image: postgres
ports:
- 5000:5432
environment:
POSTGRES_PASSWORD: example
volumes:
- type: volume
source: psql_data
target: /var/lib/postgresql/data
networks:
- app
restart: always
config:
image: kellymarchewa/config_server
networks:
- app
restart: always
search:
image: kellymarchewa/search_api
networks:
- app
restart: always
ports:
- 8081:8081
depends_on:
- db
- config
- inventory
inventory:
image: kellymarchewa/inventory_api
depends_on:
- db
- config
ports:
- 8080:8080
networks:
- app
restart: always
volumes:
psql_data:
networks:
app:
Is there anyway to access a private git repo from docker containers when a compose file is used? Thanks.