每次我在Windows 11操作系统中启动Docker桌面应用程序时,
它会自动将一个容器启动到停靠组合结构中。
但不能将其他容器合并到这个停靠组合中。
我在处理一个MariaDB容器...
我的Apache容器和PHP容器不会自动运行。
- 这是我的docker-compose.yml文件:*
version: '3'
services:
apache:
build: ./docker/apache
container_name: projectx_apache
tty: true
ports:
- '443:443'
depends_on:
- php
- mariadb
volumes:
- ./:/var/www/projectx/
php:
build: ./docker/php
container_name: projectx_php
tty: true
volumes:
- ./:/var/www/projectx/
mariadb:
build: ./docker/mariadb
container_name: projectx_mariadb
restart: always
tty: true
environment:
MYSQL_ROOT_PASSWORD: docker
MYSQL_DATABASE: projectx
MYSQL_USER: docker
MYSQL_PASSWORD: docker
ports:
- '3306:3306'
- 这是我的MariaDB容器的Dockerfile:*
FROM mariadb:latest
ENV MYSQL_ROOT_PASSWORD docker
ENV MYSQL_DATABASE projectx
ENV MYSQL_USER root
ENV MYSQL_PASSWORD docker
RUN apt-get -y update
RUN apt-get -y install vim
EXPOSE 3310
CMD ["mysqld"]
- 这是我的日志容器,当它自动启动时:*
2022-11-15 14:16:33+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.9.4+maria~ubu2204 started.
2022-11-15 14:16:33+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2022-11-15 14:16:33+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.9.4+maria~ubu2204 started.
2022-11-15 14:16:34+00:00 [Note] [Entrypoint]: MariaDB upgrade not required
2022-11-15 14:16:34 0 [Note] mysqld (server 10.9.4-MariaDB-1:10.9.4+maria~ubu2204) starting as process 1 ...
2022-11-15 14:16:34 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-11-15 14:16:34 0 [Note] InnoDB: Number of transaction pools: 1
2022-11-15 14:16:34 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2022-11-15 14:16:34 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
2022-11-15 14:16:34 0 [Warning] mysqld: io_uring_queue_init() failed with ENOMEM: try larger memory locked limit, ulimit -l, or https://mariadb.com/kb/en/systemd/#configuring-limitmemlock under systemd (262144 bytes required)
2022-11-15 14:16:34 0 [Warning] InnoDB: liburing disabled: falling back to innodb_use_native_aio=OFF
2022-11-15 14:16:34 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
2022-11-15 14:16:34 0 [Note] InnoDB: Completed initialization of buffer pool
2022-11-15 14:16:34 0 [Note] InnoDB: File system buffers for log disabled (block size=4096 bytes)
2022-11-15 14:16:34 0 [Note] InnoDB: 128 rollback segments are active.
2022-11-15 14:16:34 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
2022-11-15 14:16:34 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
2022-11-15 14:16:34 0 [Note] InnoDB: log sequence number 1489638494; transaction id 8288
2022-11-15 14:16:34 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2022-11-15 14:16:34 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-11-15 14:16:34 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
2022-11-15 14:16:34 0 [Note] Server socket created on IP: '0.0.0.0'.
2022-11-15 14:16:34 0 [Note] Server socket created on IP: '::'.
2022-11-15 14:16:34 0 [Note] mysqld: ready for connections.
Version: '10.9.4-MariaDB-1:10.9.4+maria~ubu2204' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
2022-11-15 14:16:34 0 [Note] InnoDB: Buffer pool(s) load completed at 221115 14:16:34
您知道为什么此容器会自动启动吗?
1条答案
按热度按时间jljoyd4f1#
这里自动启动的原因是MariaDB容器上的
restart: always
,它将在Docker守护进程重新启动时启动容器。