Skip to content

Commit b87fbaf

Browse files
authored
Merge pull request #829 from justinr1234/private-docker-registry
Docs for private docker registry
2 parents 83d9d0a + ac5e7f9 commit b87fbaf

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

docs/docs.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,22 @@ meteor: {
426426
}
427427
```
428428

429+
### Custom Docker Registry
430+
431+
Simply reference the docker image by url in the `meteor.docker.image` setting:
432+
433+
```
434+
meteor: {
435+
...
436+
docker: {
437+
...
438+
image: 'registry.gitlab.com/someregistry/someimage:sometag'
439+
}
440+
}
441+
```
442+
443+
And then add a docker setup hook to login to your private registry on the server. See [Hooks](#hooks) for example of logging into a private docker registry.
444+
429445
### Image Port
430446

431447
You can set `meteor.docker.port` to the port to expose from the container. This does not affect the port the app is accessed on, only the port the app runs on inside the docker container.
@@ -813,6 +829,22 @@ module.exports = {
813829
'post.meteor.restart': {
814830
remoteCommand: 'docker logs --tail 50 app-name'
815831
},
832+
'pre.docker.setup'(api) {
833+
// Login to private Gitlab docker registry
834+
const config = api.getConfig();
835+
const registry = 'registry.gitlab.com';
836+
const u = process.env.REGISTRY_USERNAME;
837+
const p = process.env.REGISTRY_PASSWORD;
838+
if (!u || !p) {
839+
throw new Error(
840+
'You must provide registry login details'
841+
);
842+
}
843+
return api.runSSHCommand(
844+
config.servers.one,
845+
`docker login -u ${u} -p ${p} ${registry}`
846+
);
847+
},
816848
'post.docker.setup'(api) {
817849
// Same api as is given to plugin command handlers
818850
// If this runs asynchronous tasks, it needs to return a promise.

0 commit comments

Comments
 (0)