Home > Software design >  Deploy docker image on DigitalOcean (Deploy Error)
Deploy docker image on DigitalOcean (Deploy Error)

Time:02-04

I'm trying to deploy docker image(Nginx Laravel MySQL) on DigitalOcean using Apps for ci/cd.
Now, the Docker image is in my Github repo which I set as "Public".
Everything is fine when I test the docker image to deploy on the Ubuntu server from DigitalOcean Droplets.
But when I try to deploy it on the App of DigitalOcean, I don't exactly know how I set "HTTP port" and "Commands" and I assumed that's why deploying is failed even though the building is succeeded.

I don't think there is anything wrong with docker-compose as it works out well on the ubuntu server.

docker-compose.yml

version: "3.7"

services:
  nginx:
    image: nginx:stable-alpine
    container_name: nginx
    ports:
      - "80:80"
    volumes:
      - ./src:/var/www
      - ./nginx:/etc/nginx/conf.d
    depends_on:
      - app
    networks:
      - app_network

  app:
    container_name: laravel
    build:
      context: .
      args:
        - uid=1000
        - user=www
      dockerfile: Dockerfile
    volumes:
      - ./php:/usr/local/etc/php/conf.d
    working_dir: /var/www
    ports:
      - "9000:9000"
    env_file:
      - .docker.env
    depends_on:
      - db
    restart: unless-stopped
    networks:
      - app_network
    links:
      - db:mysql

  db:
    image: mysql:8.0
    container_name: db
    restart: unless-stopped
    ports:
      - "3307:3306"
    env_file:
      - .docker.env
    command: ['--default-authentication-plugin=mysql_native_password']
    networks:
      - app_network
    volumes:
      - ./database:/docker-entrypoint-initdb.d
      - ./mysql/my.cnf:/etc/mysql/my.cnf

volumes:
  database:
    driver: local

networks:
  app_network:
    driver: bridge

CodePudding user response:

If you are using laravel image on Docker, then here is my solution Set Http port as "80" and set Commands as php artisan serve --host 0.0.0.0 --port 80

  •  Tags:  
  • Related