Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to push docker compose to docker hub

i have serveral services in my docker-compose file, it looks like this:

version: '3.7'

services:
  web:
    build: ./
    command: gunicorn --bind 0.0.0.0:5000 --workers 2 --worker-connections 5000 --timeout 6000 manage:app
    volumes:
      - ./:/usr/src/app/
      - static_volume:/usr/src/app/static_files
    expose:
      - 5000
    env_file:
      - ./.env.prod
    depends_on:
      - mongodb

  mongodb:
    image: mongo:4.4.1
    restart: unless-stopped
    command: mongod
    ports:
      - '27017:27017'
    environment:
      MONGODB_DATA_DIR: /data/db
      MONDODB_LOG_DIR: /dev/null
      MONGO_INITDB_ROOT_USERNAME: 
      MONGO_INITDB_ROOT_PASSWORD: 
    volumes:
      - mongodbdata:/data/db

  nginx:
    build: ./nginx
    volumes:
      - static_volume:/usr/src/app/static_files
    ports:
      - 5001:8000
    depends_on:
      - web


volumes:
  mongodbdata: 
  static_volume: 

and i have public repository on my docker hub account, i want to push all images in my app to that repo, anyone can help?

like image 565
Mamen Avatar asked Dec 07 '25 09:12

Mamen


1 Answers

You should add image names to your services, including your docker hub id, e.g.:

services:
  web:
    build: ./
    image: docker-hub-id/web:latest
    ...

Now, you can just call docker-compose push.

See docker-compose push

like image 75
Mafor Avatar answered Dec 10 '25 01:12

Mafor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!