For some reason it is not working when I try and mount a file.
Any ideas? thanks
Here is the command
docker run -d --restart unless-stopped --network host --name dewi_php -v /home/pi/ext_files/media/audio_books/:/usr/src/myapp:ro -v /home/pi/code/dot-files/serverconfig/code/server_docker/bin/php_files/index.php:/usr/src/myapp/index.php -w /usr/src/myapp php:7.4-cli php -S localhost:8919
Here is the error message
docker: Error response from daemon: failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:75: mounting "/home/pi/code/dot-files/serverconfig/code/server_docker/bin/php_files/index.php" to rootfs at "/usr/src/myapp/index.php" caused: open /var/lib/docker/overlay2/631378511a84343806b1a17da860e4c51bf64e9008942aadbc7b9ba4c1858e85/merged/usr/src/myapp/index.php: read-only file system: unknown.
The file exists:
ls /home/pi/code/dot-files/serverconfig/code/server_docker/bin/php_files/index.php
+ ls -althN --color=auto -r /home/pi/code/dot-files/serverconfig/code/server_docker/bin/php_files/index.php
-rw-r--r-- 1 pi pi 2.2K Mar 22 15:33 /home/pi/code/dot-files/serverconfig/code/server_docker/bin/php_files/index.php
Here is the docker container inspect
pi@raspberrypi:~/code/dot-files/serverconfig/code/server_docker/bin $ docker inspect dewi_php
+ docker inspect dewi_php
[
{
"Id": "862825de9a06222b7ae0fd0c91bc5f7df6d6ebf1bc7b4f5c09d9a40847636f77",
"Created": "2022-03-22T16:17:25.171962372Z",
"Path": "docker-php-entrypoint",
"Args": [
"php",
"-S",
"localhost:8919"
],
"State": {
"Status": "created",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 128,
"Error": "failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:75: mounting \"/home/pi/code/dot-files/serverconfig/code/server_docker/bin/php_files/index.php\" to rootfs at \"/usr/src/myapp/index.php\" caused: open /var/lib/docker/overlay2/0f1d3d45fb10c8d6c44958a0ff482b991b9cd982e0218bf8cd75d637a2a1c7ba/merged/usr/src/myapp/index.php: read-only file system: unknown",
"StartedAt": "0001-01-01T00:00:00Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
"Image": "sha256:61b1e58469c23eda8dc7565fe32c1f3e82627f27296f66b50b59f6e7f30ee53a",
"ResolvConfPath": "/var/lib/docker/containers/862825de9a06222b7ae0fd0c91bc5f7df6d6ebf1bc7b4f5c09d9a40847636f77/resolv.conf",
"HostnamePath": "/var/lib/docker/containers/862825de9a06222b7ae0fd0c91bc5f7df6d6ebf1bc7b4f5c09d9a40847636f77/hostname",
"HostsPath": "/var/lib/docker/containers/862825de9a06222b7ae0fd0c91bc5f7df6d6ebf1bc7b4f5c09d9a40847636f77/hosts",
"LogPath": "/var/lib/docker/containers/862825de9a06222b7ae0fd0c91bc5f7df6d6ebf1bc7b4f5c09d9a40847636f77/862825de9a06222b7ae0fd0c91bc5f7df6d6ebf1bc7b4f5c09d9a40847636f77-json.log",
"Name": "/dewi_php",
"RestartCount": 0,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": [
"/home/pi/ext_files/media/audio_books/:/usr/src/myapp:ro",
"/home/pi/code/dot-files/serverconfig/code/server_docker/bin/php_files/index.php:/usr/src/myapp/index.php"
],
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "host",
"PortBindings": {},
"RestartPolicy": {
"Name": "unless-stopped",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"CgroupnsMode": "private",
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "private",
"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": [],
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DeviceCgroupRules": null,
"DeviceRequests": null,
"KernelMemory": 0,
"KernelMemoryTCP": 0,
"MemoryReservation": 0,
"MemorySwap": 0,
"MemorySwappiness": null,
"OomKillDisable": null,
"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/0f1d3d45fb10c8d6c44958a0ff482b991b9cd982e0218bf8cd75d637a2a1c7ba-init/diff:/var/lib/docker/overlay2/baf48181bf16fdeda3662cd076a620193e614138dbbaf331e28e363e0a92a47a/diff:/var/lib/docker/overlay2/ae5c591d546b70077175e49d6d9f1643535dcd13e4ab322a987539c4f6e5ebb7/diff:/var/lib/docker/overlay2/4d7b359987e83d46f9484717915cec0e5d579ada9983a7aec45e3e9391ff113e/diff:/var/lib/docker/overlay2/fc26805bf35074fc380d815a072c6d0c3c51bf4c9e3e8cb67896ba2a04c68de6/diff:/var/lib/docker/overlay2/f44fe541897acd89a66c9618c2c4b1d8bc972d5796545e6fc45c8d64df65d297/diff:/var/lib/docker/overlay2/0156486281b7ee677365e79322650e584f4eaa777e2d45d62820044cdb2e56e6/diff:/var/lib/docker/overlay2/5222af13938c45277c12062f455837985a9f0963ae5bc679633cfd83ee0e6083/diff:/var/lib/docker/overlay2/2fda0c2a7dcd8c982520f5c90628e7306873e484d401a5d098d462a3e7e2c135/diff:/var/lib/docker/overlay2/3ba6356c734311a347337049deb9adaf840be9f53cebf14bceb27d40145ea45c/diff",
"MergedDir": "/var/lib/docker/overlay2/0f1d3d45fb10c8d6c44958a0ff482b991b9cd982e0218bf8cd75d637a2a1c7ba/merged",
"UpperDir": "/var/lib/docker/overlay2/0f1d3d45fb10c8d6c44958a0ff482b991b9cd982e0218bf8cd75d637a2a1c7ba/diff",
"WorkDir": "/var/lib/docker/overlay2/0f1d3d45fb10c8d6c44958a0ff482b991b9cd982e0218bf8cd75d637a2a1c7ba/work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "bind",
"Source": "/home/pi/ext_files/media/audio_books",
"Destination": "/usr/src/myapp",
"Mode": "ro",
"RW": false,
"Propagation": "rprivate"
},
{
"Type": "bind",
"Source": "/home/pi/code/dot-files/serverconfig/code/server_docker/bin/php_files/index.php",
"Destination": "/usr/src/myapp/index.php",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
}
],
"Config": {
"Hostname": "raspberrypi",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"PHPIZE_DEPS=autoconf \t\tdpkg-dev \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkg-config \t\tre2c",
"PHP_INI_DIR=/usr/local/etc/php",
"PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64",
"PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64",
"PHP_LDFLAGS=-Wl,-O1 -pie",
"GPG_KEYS=42670A7FE4D0441C8E4632349E4FDC074A4EF02D 5A52880781F755608BF815FC910DEB46F53EA312",
"PHP_VERSION=7.4.28",
"PHP_URL=https://www.php.net/distributions/php-7.4.28.tar.xz",
"PHP_ASC_URL=https://www.php.net/distributions/php-7.4.28.tar.xz.asc",
"PHP_SHA256=9cc3b6f6217b60582f78566b3814532c4b71d517876c25013ae51811e65d8fce"
],
"Cmd": [
"php",
"-S",
"localhost:8919"
],
"Image": "php:7.4-cli",
"Volumes": null,
"WorkingDir": "/usr/src/myapp",
"Entrypoint": [
"docker-php-entrypoint"
],
"OnBuild": null,
"Labels": {}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "b3b32cba3746ffbe5429ed1f5f8652236b0c908e015f334f960e1ead1a4d91d5",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/default",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"host": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "d0797258b71630ab5faed70463e29220db43f8dcfad431e82fc110fa14a0c9b8",
"EndpointID": "",
"Gateway": "",
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "",
"DriverOpts": null
}
}
}
}
]