Настройка контейнера докеров, содержащего веб-сервер apache, работающий в ОС Linux.
Я пытаюсь настроить среду докера, в которой я запускаю веб-сервер apache в ОС amazonlinux: 2 через докер. Я могу настроить все, но когда я загружаю URL-адрес на localhost, он возвращает сообщение «503 service unavailable». Я пытался переключить порты и т. Д. Ничего не работает, хотя это модули и т. Д., Используемые для развертывания моих серверов, не являющихся докерами. Заранее спасибо.
Следующее, что может быть актуально: Docker inspect
[
{
"Id": "8f9997578a8f16655e7e1c2c32b4be5ec06b79a886c73dd8151c6b36993c99de",
"Created": "2020-04-30T11:25:00.7273382Z",
"Path": "/usr/sbin/init",
"Args": [],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 33131,
"ExitCode": 0,
"Error": "",
"StartedAt": "2020-04-30T11:25:02.2676346Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:ba3c5108c23dcee592b14fe824776b562fe64b9685e8930e0ba365230488c558",
"ResolvConfPath": "/var/lib/docker/containers/8f9997578a8f16655e7e1c2c32b4be5ec06b79a886c73dd8151c6b36993c99de/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/8f9997578a8f16655e7e1c2c32b4be5ec06b79a886c73dd8151c6b36993c99de/hostname",
"HostsPath": "/var/lib/docker/containers/8f9997578a8f16655e7e1c2c32b4be5ec06b79a886c73dd8151c6b36993c99de/hosts",
"LogPath": "/var/lib/docker/containers/8f9997578a8f16655e7e1c2c32b4be5ec06b79a886c73dd8151c6b36993c99de/8f9997578a8f16655e7e1c2c32b4be5ec06b79a886c73dd8151c6b36993c99de-json.log",
"Name": "/webserver",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": [],
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "test_default",
"PortBindings": {
"8080/tcp": [
{
"HostIp": "",
"HostPort": "8080"
}
]
},
"RestartPolicy": {
"Name": "",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": [],
"CapAdd": null,
"CapDrop": null,
"Capabilities": null,
"Dns": null,
"DnsOptions": null,
"DnsSearch": null,
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "shareable",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": true,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": [
"label=disable"
],
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 0,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": null,
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": null,
"DeviceCgroupRules": null,
"DeviceRequests": null,
"KernelMemory": 0,
"KernelMemoryTCP": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": null,
"Ulimits": null,
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": null,
"ReadonlyPaths": null
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/632952313b6924721dbb70ce572bddc5960412d27c7c97e55a5e988fda2e4340-init/diff:/var/lib/docker/overlay2/7928f2a813c8abbff2c73e9dfcf0f6608e6da85cd775600d683025c83d3ad57c/diff:/var/lib/docker/overlay2/81ad8aaf872ad9aebfc09ed470c0f1b7d2be073c7b54acffb46262e08c4da626/diff:/var/lib/docker/overlay2/175c01b27dbb0c18765431cfe8217c49ce2dc5ddc2c690fac98a7c06f7954a86/diff:/var/lib/docker/overlay2/db4dbbd7229b9024e9e8d6a4a04cb06e7cb11e106b266831237da74f64e908a9/diff:/var/lib/docker/overlay2/43434aaa5b69556dfa16e8bf5eed24be80453ba2b9b9aa46293c92676ca895fd/diff:/var/lib/docker/overlay2/4abf428a00de2f5b3d69fe5ad95840eb23bafab9f3ce1dbe338816a64afb8b45/diff:/var/lib/docker/overlay2/f29b5cfeaa8f70f63cb823574f3c12ae7225171d880f52f9152d829510785c37/diff:/var/lib/docker/overlay2/009e8af3a21902fb29a7dd34bf70bf2e9a18e92d4a19d61af4efedc3a418f47d/diff:/var/lib/docker/overlay2/5f253c50fd411d5b6feb6b7530c4063074f825bd7d5638d9d3fe24f48d9fc15d/diff:/var/lib/docker/overlay2/c09ac469770ad1a64ad6d2cf8e329758dc9c396a10284f533fd4e88abb8b7504/diff:/var/lib/docker/overlay2/f23f1a035669c8d634ec2e6d6526314194d102c3e923b7c192ce3275e3a79b6e/diff:/var/lib/docker/overlay2/214a494e5be1bca7b560ea3c2767fc26af350cdce8a717c2c325bc124e8e2010/diff:/var/lib/docker/overlay2/43b742e71bf54d2f9beb64ad80b5737f4892d0078213d5fb455e77da0816f0fd/diff:/var/lib/docker/overlay2/31310c16a674414fdb27f9792eeae7301618d960a322d899baa77b7fa89db239/diff:/var/lib/docker/overlay2/6fec2d57bdf41b2bac187ae31518c9a3dda15af2ba2397e1524a96fb6b6df036/diff:/var/lib/docker/overlay2/eb1092c999afd90a70bc365518a95bbaf198f8462db80e5fa959cf2f1f60ec23/diff:/var/lib/docker/overlay2/cf7cf93961372b8bbf2fe3a1b3ad849ffce0cae129b7c89b5d5a182ce397da12/diff:/var/lib/docker/overlay2/330df7c9d56f024ab1c9d4157c128d709b37272001d4abbf8b6871c6b9089f15/diff",
"MergedDir": "/var/lib/docker/overlay2/632952313b6924721dbb70ce572bddc5960412d27c7c97e55a5e988fda2e4340/merged",
"UpperDir": "/var/lib/docker/overlay2/632952313b6924721dbb70ce572bddc5960412d27c7c97e55a5e988fda2e4340/diff",
"WorkDir": "/var/lib/docker/overlay2/632952313b6924721dbb70ce572bddc5960412d27c7c97e55a5e988fda2e4340/work"
},
"Name": "overlay2"
},
"Mounts": [],
"Config": {
"Hostname": "8f9997578a8f",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"3306/tcp": {},
"443/tcp": {},
"8080/tcp": {}
},
"Tty": true,
"OpenStdin": true,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": null,
"Image": "test_webserver_setup",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": [
"/usr/sbin/init"
],
"OnBuild": null,
"Labels": {
"com.docker.compose.config-hash": "f8dfaed17cde38b55e050b86a43bb0dd5429ad6c21baad83b389a19df88869b9",
"com.docker.compose.container-number": "1",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "test",
"com.docker.compose.project.config_files": "docker-compose.yaml",
"com.docker.compose.project.working_dir": "/private/docker/test",
"com.docker.compose.service": "webserver_setup",
"com.docker.compose.version": "1.25.4"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "46e724f336d8d865616f32abcc74d1ddc7dd7bd8cb15afa84992c68f38e65c8c",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"3306/tcp": null,
"443/tcp": null,
"8080/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "8080"
}
]
},
"SandboxKey": "/var/run/docker/netns/46e724f336d8",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"test_default": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"webserver_setup",
"8f9997578a8f"
],
"NetworkID": "d7c1b2428c7c8ffa4d64079053a90edbbeead91d334edee406fd848a653d0304",
"EndpointID": "1721124b84f8dd31868ebacf4ea0e86c3fc627d769d157003792744e7e1e3394",
"Gateway": "172.18.0.1",
"IPAddress": "172.18.0.2",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:12:00:02",
"DriverOpts": null
}
}
}
}
]
Вот мой файл docker-compose, который я запускаю с помощью команды docker-compose up:
version: "3.0"
services:
webserver_setup:
stdin_open: true
tty: true
privileged: true
build:
context: .
dockerfile: webserver_dockerfile
container_name: webserver
ports:
- 8080:8080
And the webserver_dockerfile
FROM amazonlinux:2
COPY ./source/ /var/www/html
#ENTRYPOINT ["/"]
RUN yum install sudo -y
RUN sudo yum update -y
RUN sudo amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2
RUN sudo yum install -y httpd mariadb-server
#install dependencies
RUN yum update -y && yum install -y \
initscripts \
mod_ssl \
gcc \
memcached \
openssl-devel \
php72-bcmath \
php72-cli \
php72-common \
php72-dba \
php72-dbg \
php72-devel \
php72-enchant \
php72-fpm \
php72-gd \
php72-gmp \
php72-imap \
php72-intl \
php72-json \
php72-ldap \
php72-mbstring \
php72-mcrypt \
php72-mysqlnd \
php72-odbc \
php72-opcache \
php72-pdo \
php72-pdo-dblib \
php72-pecl-igbinary \
php72-pecl-imagick \
php72-pecl-memcached \
php72-pecl-oauth \
php72-pecl-ssh2 \
php72-pecl-uuid \
php72-pecl-yaml \
php72-pgsql \
php72-process \
php72-pspell \
php72-recode \
php72-snmp \
php72-soap \
php72-tidy \
php72-xml \
php72-xmlrpc \
php72-zip \
php7-pear \
mysql57-server \
mongodb-org \
nano \
man \
&& yum clean all
#setup webserver and access to document directory
RUN sudo systemctl enable httpd
RUN sudo usermod -a -G apache root
RUN sudo chown -R root:apache /var/www
RUN sudo chmod 2775 /var/www && find /var/www -type d -exec sudo chmod 2775 {} \;
RUN find /var/www -type f -exec sudo chmod 0664 {} \;
#remove default config and prepare server with custom config
#RUN echo "ServerName gamingbuddy.local" >> /etc/httpd/conf/httpd.conf
RUN sed -i 's/Listen 80/Listen 0.0.0.0:8080/' /etc/httpd/conf/httpd.conf
RUN sed -i '/<Directory \"\/var\/www\">/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf
RUN sed -i '/<Directory \"\/var\/www\/html\">/,/<\/Directory>/ s/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf
RUN touch /etc/httpd/conf/vhost.conf
RUN printf "<VirtualHost *:8080> \
ServerName localhost \
<Proxy *> \
#Allow from localhost \
Order deny,allow \
Allow from all \
</Proxy> \
ProxyPass / http://172.19.0.1:8080/ retry=0 \
</VirtualHost>"
RUN rm /etc/httpd/conf.d/welcome.conf
RUN echo "Include '/etc/httpd/conf/vhost.conf'" >> /etc/httpd/conf/httpd.conf
EXPOSE 8080
EXPOSE 443
EXPOSE 3306
ENTRYPOINT ["/usr/sbin/init"]
#servers are started during build file setup
Я получаю сообщение об ошибке в отношении диспетчера процессов fastGCI, который не запускается, и перемонтирования корневой файловой системы и файловой системы ядра. Я получаю следующие ошибки и коды ошибок:
bash-4.2# systemctl status systemd-remount-fs.service
● systemd-remount-fs.service - Remount Root and Kernel File Systems
Loaded: loaded (/usr/lib/systemd/system/systemd-remount-fs.service; static; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2020-05-01 12:10:27 UTC; 2min 36s ago
Docs: man:systemd-remount-fs.service(8)
http://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
Process: 23 ExecStart=/usr/lib/systemd/systemd-remount-fs (code=exited, status=1/FAILURE)
Main PID: 23 (code=exited, status=1/FAILURE)
May 01 12:10:27 0ce19e8b1c10 systemd-remount-fs[23]: mount: /: can't find LABEL=/.
May 01 12:10:27 0ce19e8b1c10 systemd[1]: systemd-remount-fs.service: main process exited, code=exited, status=1/FAILURE
May 01 12:10:27 0ce19e8b1c10 systemd[1]: Failed to start Remount Root and Kernel File Systems.
May 01 12:10:27 0ce19e8b1c10 systemd[1]: Unit systemd-remount-fs.service entered failed state.
May 01 12:10:27 0ce19e8b1c10 systemd[1]: systemd-remount-fs.service failed.
Ошибка 2:
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2020-05-01 12:10:33 UTC; 13min ago
Process: 253 ExecStart=/usr/sbin/php-fpm --nodaemonize (code=exited, status=78)
Main PID: 253 (code=exited, status=78)
May 01 12:10:32 0ce19e8b1c10 systemd[1]: Starting The PHP FastCGI Process Manager...
May 01 12:10:33 0ce19e8b1c10 php-fpm[253]: [01-May-2020 12:10:33] ERROR: [pool www] failed to read the ACL of the socket '/run/php-fpm/www.sock': Operation not supported (95)
May 01 12:10:33 0ce19e8b1c10 php-fpm[253]: [01-May-2020 12:10:33] ERROR: FPM initialization failed
May 01 12:10:33 0ce19e8b1c10 systemd[1]: php-fpm.service: main process exited, code=exited, status=78/n/a
May 01 12:10:33 0ce19e8b1c10 systemd[1]: Failed to start The PHP FastCGI Process Manager.
May 01 12:10:33 0ce19e8b1c10 systemd[1]: Unit php-fpm.service entered failed state.
May 01 12:10:33 0ce19e8b1c10 systemd[1]: php-fpm.service failed.