相关疑难解决方法(0)

Dockerfile中的`COPY`和`ADD`命令有什么区别?

是什么之间的差异COPY,并ADD在Dockerfile命令,当我将使用一个比其他?

COPY <src> <dest>
Run Code Online (Sandbox Code Playgroud)

COPY指令将从<src>路径中复制新文件并将其添加到容器的文件系统中<dest>

ADD <src> <dest>
Run Code Online (Sandbox Code Playgroud)

ADD指令将从<src>路径中复制新文件并将其添加到容器的文件系统中<dest>.

docker dockerfile

1991
推荐指数
14
解决办法
61万
查看次数

Docker Postgres不在docker-entrypoint-initdb.d中运行初始化文件

基于Docker的Postgres 文档,我可以在其中创建任何*.sql文件/docker-entrypoint-initdb.d并使其自动运行。

我有init.sql包含CREATE DATABASE ronda;

在我的docker-compose.yaml,我有

web:
  restart: always
  build: ./web
  expose:
    - "8000"
  links:
    - postgres:postgres
  volumes:
    - /usr/src/app/static
  env_file: .env
  command: /usr/local/bin/gunicorn ronda.wsgi:application -w 2 -b :8000

nginx:
  restart: always
  build: ./nginx/
  ports:
    - "80:80"
  volumes:
    - /www/static
  volumes_from:
    - web
  links:
    - web:web

postgres:
  restart: always
  build: ./postgres/
  volumes_from:
    - data
  ports:
    - "5432:5432"

data:
  restart: always
  build: ./postgres/
  volumes:
    - /var/lib/postgresql
  command: "true"
Run Code Online (Sandbox Code Playgroud)

还有我的postgres Dockerfile,

FROM …
Run Code Online (Sandbox Code Playgroud)

postgresql docker docker-compose

5
推荐指数
1
解决办法
4540
查看次数

标签 统计

docker ×2

docker-compose ×1

dockerfile ×1

postgresql ×1