Im want to paste environment variables, which contain passwords for AWS services, through the docker-compose command.
Tried to find a solution, but i find only answers suggesting to use the .env file. This isnt a solution for me, as the file will still contain sensitive informations and will be pushed to git.
One part of the docker-compose.yml looks like this:
example.server:
image: ${DOCKER_REGISTRY-}exampleserver
container_name: exampleserver
build:
context: ..
dockerfile: src/Web/Example.Server/Dockerfile
args:
ARTIFACTORY_USERNAME: ARTIFACTORY_USERNAME
ARTIFACTORY_PASSWORD: ARTIFACTORY_PASSWORD
We paste the artifactory args through the docker-compose command line:
docker-compose --profile test build --build-arg ARTIFACTORY_USERNAME="some username" --build-arg ARTIFACTORY_PASSWORD="some password"
Now i added the environments to the yml file:
example.server:
image: ${DOCKER_REGISTRY-}exampleserver
container_name: exampleserver
build:
context: ..
dockerfile: src/Web/Example.Server/Dockerfile
args:
ARTIFACTORY_USERNAME: ARTIFACTORY_USERNAME
ARTIFACTORY_PASSWORD: ARTIFACTORY_PASSWORD
environment:
- AWSKey=someKey
- AWSBucketName=someName
- AWSSecretKey=someSecretKey
This works. The environment variables can be seen in example.server when docker has build the image.
But as the keys are hardcoded inside the docker-compose.yml, i want to paste them through the docker-compose command. The same way, we are pasting the password for the artifactory.
Is it possible?