Reputation: 609
I have a project that has 2 Dockerfiles; one for the frontend and another for the backend.
However in my local machine, I've created a docker-compose.yml
file that will build the respective Dockerfiles inside respective folders and run them in the prescribed order
Current structure
.
+-- api
| +-- Dockerfile
| +-- ...
+-- frontend
| +-- Dockerfile
| +-- ...
+-- docker-compose.yml
So, locally the stack is started through docker-compose up
.
I'm now planning to get the entire stack into a private registry.
What would be the best way to get the images up, making it easy for dev and CI/CD routines?
Dockerfile
images pushed individually and pulled into a new server? oror let me know the most efficient method to deploy this.
Upvotes: 2
Views: 3927
Reputation: 16910
To push multiple images that are build by your compose you can use docker-compose push
command. Remember that image names in your compose should be in appropriate format. Your docker compose could look like :
version: '3'
services:
sv1:
build: .
image: localhost:4000/imgename:tag # for local registry
sv2:
build: .
image: hubusername/imagename:tag # for DockerHub registry
With this command you can push all images at once, but you can also specify service name, whose image you want to push. You can then download those images from your repository separately.
Upvotes: 4