Я создал контейнер docker для приложения Laravel
. Когда я пытаюсь получить к нему доступ из Интернета, я получаю страницу html с надписью «Это работает». Мне не удалось найти этот файл HTML внутри контейнера docker, даже когда я вошел как root. Я смонтировал файл конфигурации apache с файлом apache2.conf
в моем проекте. Ниже я приведу код с настройкой, потому что у меня уже нет идей.
Docker контейнер после запуска docker inspecct webserver
{
"Id": "e0a6f58269ebdfb67afcebbac397727d065dda5a7159cd63e296f7ca0bf18552",
"Created": "2020-02-07T08:37:24.701014739Z",
"Path": "/entrypoint.sh",
"Args": [
"/run.sh"
],
"State": {
"Status": "running",
"Running": true,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 13842,
"ExitCode": 0,
"Error": "",
"StartedAt": "2020-02-07T08:44:04.129079753Z",
"FinishedAt": "2020-02-07T08:43:54.29560322Z"
},
"Image": "sha256:2917481c38ded1d217cf1498a3ebc7378916ce7d9a06e06377e7c296fd80827e",
"ResolvConfPath": "/var/lib/docker/containers/e0a6f58269ebdfb67afcebbac397727d065dda5a7159cd63e296f7ca0bf18552/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/e0a6f58269ebdfb67afcebbac397727d065dda5a7159cd63e296f7ca0bf18552/hostname",
"HostsPath": "/var/lib/docker/containers/e0a6f58269ebdfb67afcebbac397727d065dda5a7159cd63e296f7ca0bf18552/hosts",
"LogPath": "/var/lib/docker/containers/e0a6f58269ebdfb67afcebbac397727d065dda5a7159cd63e296f7ca0bf18552/e0a6f58269ebdfb67afcebbac397727d065dda5a7159cd63e296f7ca0bf18552-json.log",
"Name": "/webserver",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "docker-default",
"ExecIDs": [
"3f34da41b52416c84ba6a9a88d38b75f65715fa1b3766cfb545fb4fef6871fdb"
],
"HostConfig": {
"Binds": [
"/home/chris/Public/Projects/admin-website/docker/apache2/default.conf:/etc/apache2/apache2.conf:rw",
"/home/chris/Public/Projects/website:/var/www/admin-website:rw"
],
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "website_app-network",
"PortBindings": {
"443/tcp": [
{
"HostIp": "",
"HostPort": "443"
}
],
"8080/tcp": [
{
"HostIp": "",
"HostPort": "8080"
}
]
},
"RestartPolicy": {
"Name": "unless-stopped",
"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": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"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": [
"/proc/asound",
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/a45b15f7a18a3a7ea624dbf14e3f723426611ba75f64a8e10d7b7e4c33dd4d79-init/diff:/var/lib/docker/overlay2/005275602d2c99dd75b65bd10a71e264d0c5c73d5b1e4e5127c7f74335184d58/diff:/var/lib/docker/overlay2/5af8337dbc6e47fe9843bce35777aeadaa49253f4d75b0827c9571640ea2289b/diff:/var/lib/docker/overlay2/2c55f1c77761d6ae27778ee70e33606da0b04f52a24e3c9a70819a243216d68e/diff:/var/lib/docker/overlay2/0090ca1d47c0f281c8abfd98863e8a6a7896be449b03771c5f3ac1fe10d8d5ae/diff:/var/lib/docker/overlay2/2a83e2e784cb5fb3b852da312c89ad4abf6f42e3408e1bf236ecf9a564f371d4/diff:/var/lib/docker/overlay2/c6a2488ca71dcb2279909dd24b781b5ee8a0fd80bead495e5b5851c0f4efbc62/diff:/var/lib/docker/overlay2/1a4fdba6c32cf797cd820f82e95f3d0eed837b1c8103458317c10450f57714f9/diff:/var/lib/docker/overlay2/e0dca46d5ad13ceea4274955428e94b82abc037907da0e57a633e9ebc183b74e/diff:/var/lib/docker/overlay2/0453a3d8c5d31dd4481ab1f2dd670a96a7f1e0c5c39b429d0123d26b69dc6998/diff:/var/lib/docker/overlay2/291d9e57dae6eefd324d21a6bf593f4a3e244cc44c3a83101b37d57f5dc24e4c/diff",
"MergedDir": "/var/lib/docker/overlay2/a45b15f7a18a3a7ea624dbf14e3f723426611ba75f64a8e10d7b7e4c33dd4d79/merged",
"UpperDir": "/var/lib/docker/overlay2/a45b15f7a18a3a7ea624dbf14e3f723426611ba75f64a8e10d7b7e4c33dd4d79/diff",
"WorkDir": "/var/lib/docker/overlay2/a45b15f7a18a3a7ea624dbf14e3f723426611ba75f64a8e10d7b7e4c33dd4d79/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "bind",
"Source": "/home/chris/Public/Projects/admin-webiste/docker/apache2/default.conf",
"Destination": "/etc/apache2/apache2.conf",
"Mode": "rw",
"RW": true,
"Propagation": "rprivate"
},
{
"Type": "bind",
"Source": "/home/chris/Public/Projects/website",
"Destination": "/var/www/website",
"Mode": "rw",
"RW": true,
"Propagation": "rprivate"
}
],
"Config": {
"Hostname": "e0a6f58269eb",
"Domainname": "",
"User": "1001",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"443/tcp": {},
"8080/tcp": {},
"8443/tcp": {}
},
"Tty": true,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/opt/bitnami/apache/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"HOME=/",
"OS_ARCH=amd64",
"OS_FLAVOUR=debian-10",
"OS_NAME=linux",
"BITNAMI_APP_NAME=apache",
"BITNAMI_IMAGE_VERSION=2.4.41-debian-10-r11"
],
"Cmd": [
"/run.sh"
],
"Image": "bitnami/apache:latest",
"Volumes": {
"/etc/apache2/apache2.conf": {},
"/var/www/website": {}
},
"WorkingDir": "/app",
"Entrypoint": [
"/entrypoint.sh"
],
"OnBuild": null,
"Labels": {
"com.docker.compose.config-hash": "adc335a950efdb40fd9f77c9b13183c105f335558bdf520a53efc5a766da703d",
"com.docker.compose.container-number": "1",
"com.docker.compose.oneoff": "False",
"com.docker.compose.project": "website",
"com.docker.compose.service": "webserver",
"com.docker.compose.version": "1.21.2",
"maintainer": "Bitnami <containers@bitnami.com>"
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "6f59eae37eba7f2311be05b01709f24210516ce77f3d16ba7df04c22292a400a",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {
"443/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "443"
}
],
"8080/tcp": [
{
"HostIp": "0.0.0.0",
"HostPort": "8080"
}
],
"8443/tcp": null
},
"SandboxKey": "/var/run/docker/netns/6f59eae37eba",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"website_app-network": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"webserver",
"e0a6f58269eb"
],
"NetworkID": "ce41a007f03c021c5162a63862f2a520671bfc1a7f1f7917c8ceace25f5a4f25",
"EndpointID": "5ed5440ba5f089e5308371f106b0a978010d42980f2a876d3e214a2e598b4e20",
"Gateway": "172.20.0.1",
"IPAddress": "172.20.0.3",
"IPPrefixLen": 16,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "02:42:ac:14:00:03",
"DriverOpts": null
}
}
}
}
Apache2 configration file on the webserver:etc/apache2/apache2.conf
<VirtualHost *:8080>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
DocumentRoot /var/www/website/public
ServerName admin.website.docker
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
Docker -Compose.yml
и, наконец, Dockerfile
Dockerfile
Когда я вошел как sudo и перешел в папку /etc/apache2/
там, где нет sites-enabled
или чего-либо подобного, просто файл конфигурации, который я скопировал с моей локальной машины.
![enter image description here](https://i.stack.imgur.com/RJuCS.png)