docker 下安裝postgresql

陳洪光發表於2019-11-25

建立所需目錄

$ mkdir -p /home/docker/compose
$ mkdir -p /home/docker/data/postgresql/data
$ cd /home/docker/compose/
$ vim postgrsql12.yml
version: '3'
services:
   postgresql:
      image: postgres:12.1-alpine
      container_name: postgresql-12
      restart: always
      volumes:
         - ./data/postgresql/data:/var/lib/postgresql
      networks:
         - net-a
      ports:
         - 5432:5432
      environment:
         - POSTGRES_PASSWORD=qwe123
networks:
   net-a:
      external: false
      
$ docker-compose -f /home/docker/compose/postgrsql12.yml up -d


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25357621/viewspace-2665628/,如需轉載,請註明出處,否則將追究法律責任。

相關文章