0

I have some services running when I run docker-compose up command. Now I want to make an image from the current environment and share it with docker hub so that every time I can use docker pull/run my_own_image command from the docker hub.

Is there any way to do that?

Bablu Ahmed
  • 4,412
  • 5
  • 49
  • 64
  • Use [`docker push`](https://docs.docker.com/engine/reference/commandline/push/) and [`docker login`](https://docs.docker.com/engine/reference/commandline/login/) to login into your Hub account. – Stefan Golubović Mar 27 '20 at 20:01
  • @StefanGolubović in the link I found from only one container to an image but I need all running containers to an image – Bablu Ahmed Mar 27 '20 at 20:19

1 Answers1

1

Pretty much anything that you can do with images or containers with Docker, you can do with Compose. In your case, since you can push your custom image to your Docker Hub registry using docker image push (or docker push) command, you can do the same with Compose.

As for Compose, you use docker-compose push (no surprises there – consistency between APIs/CLIs).


Tip: when in doubt, use --help. It's the best way (next to Google) to explore CLI. If not sure what are available commands/options for Compose, just type docker-compose --help. If you want to see available options for push command (for example), use docker-compose push --help.

Stefan Golubović
  • 1,225
  • 1
  • 16
  • 21