更改 .env 文件后,执行 "docker-compose up d" 是否足以应用更改?

After changing the .env file, is it enough to execute "docker-compose up d" to apply changes?

首先我想说我对服务器和 Docker 不熟悉。所以对我放轻松。 我正在对通过 google 控制台云连接的服务器进行一些更改。更改在 .env 文件中。我做了一些配置更改。然后我知道我必须做一些事情,比如关闭服务器并重新启动它以使更改生效。我执行了 docker-compose up -d 但我想要的并没有发生。所以也许我应该说 docker-compose down 或者它没有发生的原因是因为我在服务器中的代码?

这东西用于 self-hosted jitsi(视频会议)服务器。我正在尝试激活 jwt 令牌身份验证选项。这是我在 .env 文件中所做的更改:

#Enable authentication
ENABLE_AUTH=1
# Enable guest access
ENABLE_GUESTS=0
# Select authentication type: internal, jwt or ldap
AUTH_TYPE=jwt
# JWT authentication
# Application identifier
JWT_APP_ID= myıd
JWT_APP_SECRET=myscret

这是一个最小的可重现示例,表明您不需要 运行 一个 docker-compose down 来查看 .env 文件中的更改:

$ cat docker-compose.yml 
version: '3.7'
services:
  app:
    image: busybox
    container_name: test-env
    command: tail -f /dev/null
    environment:
      message: ${message}

$ docker-compose up -d
Creating network "64553060_default" with the default driver
Creating test-env ... done

$ cat .env
message=hello world

$ docker exec test-env env | grep message
message=hello world

$ vi .env

$ docker-compose up -d
Recreating test-env ... done

$ cat .env
message=hello Whosebug

$ docker exec test-env env | grep message
message=hello Whosebug