Hello,
I added a command as follows to the YAML file:
version: '3.9'
services:
web:
image: nginx:latest
container_name: Nginx
command: sh -c "apt update && apt install iputils-ping -y"
ports:
- '8080:80'
volumes:
- ./default.conf:/etc/nginx/conf.d/default.conf
- /var/www/html:/usr/share/nginx/html
depends_on:
- php-fpm
php-fpm:
image: php:8-fpm
container_name: PHP
volumes:
- /var/www/html:/usr/share/nginx/html/
- /var/www/html:/usr/local/apache2/htdocs/
But after this, the Nginx container will no longer run. The log tells me that everything seems to have run successfully:
Attaching to Nginx, PHP
PHP | [30-Mar-2024 12:47:38] NOTICE: fpm is running, pid 1
PHP | [30-Mar-2024 12:47:38] NOTICE: ready to handle connections
Nginx |
Nginx | WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Nginx |
Nginx | Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Nginx | Get:2 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Nginx | Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Nginx | Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8786 kB]
Nginx | Get:5 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [12.7 kB]
Nginx | Get:6 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [147 kB]
Nginx | Fetched 9201 kB in 47s (194 kB/s)
Nginx | Reading package lists...
Nginx | Building dependency tree...
Nginx | Reading state information...
Nginx | All packages are up to date.
Nginx |
Nginx | WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
Nginx |
Nginx | Reading package lists...
Nginx | Building dependency tree...
Nginx | Reading state information...
Nginx | The following additional packages will be installed:
Nginx | libcap2-bin libpam-cap
Nginx | The following NEW packages will be installed:
Nginx | iputils-ping libcap2-bin libpam-cap
Nginx | 0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Nginx | Need to get 96.2 kB of archives.
Nginx | After this operation, 311 kB of additional disk space will be used.
Nginx | Get:1 http://deb.debian.org/debian bookworm/main amd64 libcap2-bin amd64 1:2.66-4 [34.7 kB]
Nginx | Get:2 http://deb.debian.org/debian bookworm/main amd64 iputils-ping amd64 3:20221126-1 [47.1 kB]
Nginx | Get:3 http://deb.debian.org/debian bookworm/main amd64 libpam-cap amd64 1:2.66-4 [14.5 kB]
Nginx | debconf: delaying package configuration, since apt-utils is not installed
Nginx | Fetched 96.2 kB in 0s (219 kB/s)
Nginx | Selecting previously unselected package libcap2-bin.
(Reading database ... 7590 files and directories currently installed.)
Nginx | Preparing to unpack .../libcap2-bin_1%3a2.66-4_amd64.deb ...
Nginx | Unpacking libcap2-bin (1:2.66-4) ...
Nginx | Selecting previously unselected package iputils-ping.
Nginx | Preparing to unpack .../iputils-ping_3%3a20221126-1_amd64.deb ...
Nginx | Unpacking iputils-ping (3:20221126-1) ...
Nginx | Selecting previously unselected package libpam-cap:amd64.
Nginx | Preparing to unpack .../libpam-cap_1%3a2.66-4_amd64.deb ...
Nginx | Unpacking libpam-cap:amd64 (1:2.66-4) ...
Nginx | Setting up libcap2-bin (1:2.66-4) ...
Nginx | Setting up libpam-cap:amd64 (1:2.66-4) ...
Nginx | debconf: unable to initialize frontend: Dialog
Nginx | debconf: (TERM is not set, so the dialog frontend is not usable.)
Nginx | debconf: falling back to frontend: Readline
Nginx | debconf: unable to initialize frontend: Readline
Nginx | debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.36.0 /usr/local/share/perl/5.36.0 /usr/lib/x86_64-linux-gnu/perl5/5.36 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.36 /usr/share/perl/5.36 /usr/local/lib/site_perl) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
Nginx | debconf: falling back to frontend: Teletype
Nginx | Setting up iputils-ping (3:20221126-1) ...
What is wrong?
Cheers.