• 文档——dockercompose up重复执行会怎样


    情景

    在使用docker-compose启动服务的时候,执行下面的命令即可

    # 前台启动
    docker-compose up
    
    # 后台启动
    docker-compose up -d
    

    那么当服务已经启动的情况下,再次执行docker-compose up会是什么功能?

    从以往经验看,似乎会更新docker-compose启动的服务。下面验证一下

    验证

    启动一组docker-compose

    随便起一个服务,docker-compose.yml如下:

    version: '2'
    services:
      web:
        image: "nginx:alpine"
        ports:
          - "80:80"
        volumes:
          - my-vol:/var/www/html
      db:
        image: "mysql"
        restart: always
        environment:
          MYSQL_ROOT_PASSWORD: password
    volumes:
      my-vol: {}
    

    随后启动

    root@wang-PC:/home/wang/docker_compose_test# docker-compose up
    Pulling web (nginx:alpine)...
    alpine: Pulling from library/nginx
    9b18e9b68314: Pull complete
    51048c2d0108: Downloading [================================================>  ]  7.113MB/7.297MB
    51048c2d0108: Pull complete
    3897c47760f3: Pull complete
    f61a6b717778: Pull complete
    56ed090e0ec8: Pull complete
    e5a0a61a0146: Pull complete
    Digest: sha256:082f8c10bd47b6acc8ef15ae61ae45dd8fde0e9f389a8b5cb23c37408642bf5d
    Status: Downloaded newer image for nginx:alpine
    Pulling db (mysql:)...
    latest: Pulling from library/mysql
    9a8b791677e1: Pull complete
    51c023923f62: Pull complete
    af22db8f5e18: Pull complete
    428c3a923aa3: Pull complete
    830d9608cd58: Pull complete
    9914654f8cd5: Pull complete
    22a35992845d: Downloading [==========================>                        ]  28.47MB/53.82MB
    54d4540528c8: Download complete
    4c6ec168f6cf: Download complete
    22a35992845d: Downloading [========================================>          ]  44.01MB/53.82MB
    27e5cc37f4b1: Download complete
    22a35992845d: Downloading [==============================================>    ]  50.43MB/53.82MB
    22a35992845d: Pull complete
    54d4540528c8: Pull complete
    4c6ec168f6cf: Pull complete
    1742f8a782c5: Pull complete
    27e5cc37f4b1: Pull complete
    Digest: sha256:b9532b1edea72b6cee12d9f5a78547bd3812ea5db842566e17f8b33291ed2921
    Status: Downloaded newer image for mysql:latest
    Creating docker_compose_test_web_1 ... done
    Creating docker_compose_test_db_1  ... done
    Attaching to docker_compose_test_web_1, docker_compose_test_db_1
    web_1  | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
    web_1  | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
    web_1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
    web_1  | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
    db_1   | 2022-09-20 02:52:59+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
    web_1  | 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
    web_1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
    web_1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
    web_1  | /docker-entrypoint.sh: Configuration complete; ready for start up
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: using the "epoll" event method
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: nginx/1.23.1
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: built by gcc 11.2.1 20220219 (Alpine 11.2.1_git20220219) 
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: OS: Linux 4.19.71-arm64-desktop
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker processes
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker process 31
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker process 32
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker process 33
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker process 34
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker process 35
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker process 36
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker process 37
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker process 38
    db_1   | 2022-09-20 02:52:59+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
    db_1   | 2022-09-20 02:52:59+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
    db_1   | 2022-09-20 02:52:59+00:00 [Note] [Entrypoint]: Initializing database files
    db_1   | 2022-09-20T02:52:59.832257Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
    db_1   | 2022-09-20T02:52:59.832346Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.30) initializing of server in progress as process 81
    db_1   | 2022-09-20T02:52:59.840806Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
    db_1   | 2022-09-20T02:53:00.448205Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
    db_1   | 2022-09-20T02:53:01.794720Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
    db_1   | 2022-09-20 02:53:05+00:00 [Note] [Entrypoint]: Database files initialized
    db_1   | 2022-09-20 02:53:05+00:00 [Note] [Entrypoint]: Starting temporary server
    db_1   | 2022-09-20T02:53:05.298592Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
    db_1   | 2022-09-20T02:53:05.299705Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 132
    db_1   | 2022-09-20T02:53:05.317821Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
    db_1   | 2022-09-20T02:53:05.472012Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
    db_1   | 2022-09-20T02:53:05.712884Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
    db_1   | 2022-09-20T02:53:05.712946Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
    db_1   | 2022-09-20T02:53:05.716462Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
    db_1   | 2022-09-20T02:53:05.739808Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.30'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server - GPL.
    db_1   | 2022-09-20T02:53:05.739765Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
    db_1   | 2022-09-20 02:53:05+00:00 [Note] [Entrypoint]: Temporary server started.
    db_1   | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
    web_1  | 172.18.0.1 - - [20/Sep/2022:02:53:06 +0000] "HEAD / HTTP/1.1" 200 0 "-" "Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" "-"
    web_1  | 172.18.0.1 - - [20/Sep/2022:02:53:06 +0000] "HEAD / HTTP/1.1" 200 0 "-" "Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" "-"
    db_1   | Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
    db_1   | Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
    db_1   | Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
    db_1   | Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
    db_1   | Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
    db_1   | 
    db_1   | 2022-09-20 02:53:07+00:00 [Note] [Entrypoint]: Stopping temporary server
    db_1   | 2022-09-20T02:53:07.851225Z 10 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.0.30).
    db_1   | 2022-09-20T02:53:09.522259Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.
    db_1   | 2022-09-20 02:53:09+00:00 [Note] [Entrypoint]: Temporary server stopped
    db_1   | 
    db_1   | 2022-09-20 02:53:09+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
    db_1   | 
    db_1   | 2022-09-20T02:53:10.108489Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
    db_1   | 2022-09-20T02:53:10.109510Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
    db_1   | 2022-09-20T02:53:10.115120Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
    db_1   | 2022-09-20T02:53:10.258746Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
    db_1   | 2022-09-20T02:53:10.432465Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
    db_1   | 2022-09-20T02:53:10.432507Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
    db_1   | 2022-09-20T02:53:10.434719Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
    db_1   | 2022-09-20T02:53:10.459444Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.30'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
    db_1   | 2022-09-20T02:53:10.459481Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
    

    可以看到,会先下载镜像,随后启动服务。

    执行 docker ps来查看容器启动情况,可以看到两个服务都正常启动

    wang@wang-PC:~/docker_compose_test$ docker ps
    CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                 NAMES
    74324c4961ae        mysql               "docker-entrypoint.s…"   3 hours ago         Up 3 hours          3306/tcp, 33060/tcp   docker_compose_test_db_1
    c32f33c2f88a        nginx:alpine        "/docker-entrypoint.…"   3 hours ago         Up 3 hours          0.0.0.0:80->80/tcp    docker_compose_test_web_1
    

    在文件夹下再次执行docker-compose up

    再打开一个终端,在项目文件夹下执行docker-compose up

    wang@wang-PC:~/docker_compose_test$ docker-compose up
    docker_compose_test_web_1 is up-to-date
    docker_compose_test_db_1 is up-to-date
    Attaching to docker_compose_test_web_1, docker_compose_test_db_1
    web_1  | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
    web_1  | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
    web_1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
    web_1  | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
    web_1  | 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
    web_1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
    web_1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
    web_1  | /docker-entrypoint.sh: Configuration complete; ready for start up
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: using the "epoll" event method
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: nginx/1.23.1
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: built by gcc 11.2.1 20220219 (Alpine 11.2.1_git20220219) 
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: OS: Linux 4.19.71-arm64-desktop
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker processes
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker process 31
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker process 32
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker process 33
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker process 34
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker process 35
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker process 36
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker process 37
    web_1  | 2022/09/20 02:52:59 [notice] 1#1: start worker process 38
    

    可以看到,前两行日志,提示的是 两个服务都已经是最新状态 。然后会attach到容器中打印执行日志,和启动服务时,没有差异。

    那如果对服务进行一些变更,再执行,是否会更新服务?

    更新yml后再执行docker-compose up

    对yml进行一些变更,此处为增加一个映射端口,修改成

    version: '2'
    services:
      web:
        image: "nginx:alpine"
        ports:
          - "80:80"
          - "8080:8080"
        volumes:
          - my-vol:/var/www/html
      db:
        image: "mysql"
        restart: always
        environment:
          MYSQL_ROOT_PASSWORD: password
    volumes:
      my-vol: {}
    

    不关服务,再次执行docker-compose up

    wang@wang-PC:~/docker_compose_test$ docker-compose up
    Recreating docker_compose_test_web_1 ... 
    Recreating docker_compose_test_web_1 ... done
    Attaching to docker_compose_test_db_1, docker_compose_test_web_1
    web_1  | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
    web_1  | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
    web_1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
    web_1  | 10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
    web_1  | 10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
    web_1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
    web_1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
    web_1  | /docker-entrypoint.sh: Configuration complete; ready for start up
    web_1  | 2022/09/20 06:32:10 [notice] 1#1: using the "epoll" event method
    web_1  | 2022/09/20 06:32:10 [notice] 1#1: nginx/1.23.1
    web_1  | 2022/09/20 06:32:10 [notice] 1#1: built by gcc 11.2.1 20220219 (Alpine 11.2.1_git20220219) 
    web_1  | 2022/09/20 06:32:10 [notice] 1#1: OS: Linux 4.19.71-arm64-desktop
    web_1  | 2022/09/20 06:32:10 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
    web_1  | 2022/09/20 06:32:10 [notice] 1#1: start worker processes
    web_1  | 2022/09/20 06:32:10 [notice] 1#1: start worker process 31
    web_1  | 2022/09/20 06:32:10 [notice] 1#1: start worker process 32
    web_1  | 2022/09/20 06:32:10 [notice] 1#1: start worker process 33
    web_1  | 2022/09/20 06:32:10 [notice] 1#1: start worker process 34
    web_1  | 2022/09/20 06:32:10 [notice] 1#1: start worker process 35
    web_1  | 2022/09/20 06:32:10 [notice] 1#1: start worker process 36
    web_1  | 2022/09/20 06:32:10 [notice] 1#1: start worker process 37
    web_1  | 2022/09/20 06:32:10 [notice] 1#1: start worker process 38
    db_1   | 2022-09-20 02:52:59+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
    db_1   | 2022-09-20 02:52:59+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
    db_1   | 2022-09-20 02:52:59+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.30-1.el8 started.
    db_1   | 2022-09-20 02:52:59+00:00 [Note] [Entrypoint]: Initializing database files
    db_1   | 2022-09-20T02:52:59.832257Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
    db_1   | 2022-09-20T02:52:59.832346Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.30) initializing of server in progress as process 81
    db_1   | 2022-09-20T02:52:59.840806Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
    db_1   | 2022-09-20T02:53:00.448205Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
    db_1   | 2022-09-20T02:53:01.794720Z 6 [Warning] [MY-010453] [Server] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
    db_1   | 2022-09-20 02:53:05+00:00 [Note] [Entrypoint]: Database files initialized
    db_1   | 2022-09-20 02:53:05+00:00 [Note] [Entrypoint]: Starting temporary server
    db_1   | 2022-09-20T02:53:05.298592Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
    db_1   | 2022-09-20T02:53:05.299705Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 132
    db_1   | 2022-09-20T02:53:05.317821Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
    db_1   | 2022-09-20T02:53:05.472012Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
    db_1   | 2022-09-20T02:53:05.712884Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
    db_1   | 2022-09-20T02:53:05.712946Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
    db_1   | 2022-09-20T02:53:05.716462Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
    db_1   | 2022-09-20T02:53:05.739808Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.30'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server - GPL.
    db_1   | 2022-09-20T02:53:05.739765Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: /var/run/mysqld/mysqlx.sock
    db_1   | 2022-09-20 02:53:05+00:00 [Note] [Entrypoint]: Temporary server started.
    db_1   | '/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
    db_1   | Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
    db_1   | Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
    db_1   | Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.
    db_1   | Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
    db_1   | Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
    db_1   | 
    db_1   | 2022-09-20 02:53:07+00:00 [Note] [Entrypoint]: Stopping temporary server
    db_1   | 2022-09-20T02:53:07.851225Z 10 [System] [MY-013172] [Server] Received SHUTDOWN from user root. Shutting down mysqld (Version: 8.0.30).
    db_1   | 2022-09-20T02:53:09.522259Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.30)  MySQL Community Server - GPL.
    db_1   | 2022-09-20 02:53:09+00:00 [Note] [Entrypoint]: Temporary server stopped
    db_1   | 
    db_1   | 2022-09-20 02:53:09+00:00 [Note] [Entrypoint]: MySQL init process done. Ready for start up.
    db_1   | 
    db_1   | 2022-09-20T02:53:10.108489Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
    db_1   | 2022-09-20T02:53:10.109510Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.30) starting as process 1
    db_1   | 2022-09-20T02:53:10.115120Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
    db_1   | 2022-09-20T02:53:10.258746Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
    db_1   | 2022-09-20T02:53:10.432465Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
    db_1   | 2022-09-20T02:53:10.432507Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
    db_1   | 2022-09-20T02:53:10.434719Z 0 [Warning] [MY-011810] [Server] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
    db_1   | 2022-09-20T02:53:10.459444Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.30'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server - GPL.
    db_1   | 2022-09-20T02:53:10.459481Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
    web_1  | 172.18.0.1 - - [20/Sep/2022:06:32:12 +0000] "HEAD / HTTP/1.1" 200 0 "-" "Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" "-"
    web_1  | 172.18.0.1 - - [20/Sep/2022:06:32:12 +0000] "HEAD / HTTP/1.1" 200 0 "-" "Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" "-"
    web_1  | 172.18.0.1 - - [20/Sep/2022:06:32:14 +0000] "HEAD / HTTP/1.1" 200 0 "-" "Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" "-"
    web_1  | 172.18.0.1 - - [20/Sep/2022:06:32:14 +0000] "HEAD / HTTP/1.1" 200 0 "-" "Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" "-"
    web_1  | 172.18.0.1 - - [20/Sep/2022:06:32:14 +0000] "HEAD / HTTP/1.1" 200 0 "-" "Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36" "-"
    

    关注前两行,会发现,由于更新了配置,web容器重新创建了。

    随后attach到容器中,打印其执行日志。

    也就是说,更新了配置文件的service,再执行docker-compose会重新创建,没有更新的不会重启、更新。

  • 相关阅读:
    网站备份list
    vnc checklist
    appnode iptables 规则后面覆盖前面的
    Appnode + Discuz checklist
    解决WORD文档无法显示链接的图像问题
    应用容器Application container
    要研究的内容
    转 Flex MXML编译成AS类
    Flex文件结构
    int a
  • 原文地址:https://www.cnblogs.com/wswang/p/16828593.html
Copyright © 2020-2023  润新知