Skip to content

Commit 5e9b70d

Browse files
committed
added record to CHANGELOG and added usage documentation
1 parent 37e63c8 commit 5e9b70d

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
33

44
### Fixed
55
- Fixed retrieval of Docker host IP when running inside Docker. ([\#479](https://github.com/testcontainers/testcontainers-java/issues/479))
6+
- Compose can now pull images from private repositories.
67
- Fixed overriding MySQL image command. ([\#534](https://github.com/testcontainers/testcontainers-java/issues/534))
78

89
### Changed

docs/usage/docker_compose.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,44 @@ String redisUrl = environment.getServiceHost("redis_1", REDIS_PORT)
5353
+ ":" +
5454
environment.getServicePort("redis_1", REDIS_PORT);
5555
```
56+
57+
## Using private repositories in Docker compose
58+
When Docker Compose is used in container mode (not local), it's needs to be made aware of Docker settings for private repositories.
59+
By default, those setting are located in `$HOME/.docker/config.json`.
60+
61+
There are 3 ways to specify location of the `config.json` for Docker Compose
62+
* Use `DOCKER_CONFIG_FILE` environment variable.
63+
64+
`export DOCKER_CONFIG_FILE=/some/location/config.json`
65+
66+
* Use `dockerConfigFile` java property
67+
68+
`java -DdockerConfigFile=/some/location/config.json`
69+
70+
* Don't specify anything, in this case default location `$HOME/.docker/config.json`, if present, will be used
71+
72+
####Note to OSX users
73+
By default, Docker for mac uses Keychain to store private repositories' keys. So, your `config.json` looks like
74+
```$json
75+
{
76+
"auths" : {
77+
"https://index.docker.io/v1/" : {
78+
}
79+
},
80+
"credsStore" : "osxkeychain"
81+
}
82+
```
83+
84+
Docker Compose in container cannot access the Keychain, thus making the configuration useless.
85+
To work around this problem, create `config.json` in separate location with real authentication keys, like
86+
```$json
87+
{
88+
"auths" : {
89+
"https://index.docker.io/v1/" : {
90+
"auth": "QWEADSZXC..."
91+
}
92+
},
93+
"credsStore" : "osxkeychain"
94+
}
95+
```
96+
and specify the location to TestContainers using any of the two first methods from above.

0 commit comments

Comments
 (0)