i have the following problem:
my nginx container is starting with read only root-filesystem and i have configured two tmpfs-mounts: /var/run and /var/cache/nginx like it’s described there: https://hub.docker.com/_/nginx
At startup nginx throws this error and the container stops:
2021/08/26 06:31:16 [emerg] 1#1: mkdir() "/var/cache/nginx/client_temp" failed (30: Read-only file system)
This is my ecs task-config:
{
"name": "nginx",
"essential": false,
"readonlyRootFilesystem": true,
"healthCheck": {
"command": [
"CMD-SHELL",
"curl --fail 127.0.0.1 || exit 1"
],
"interval": 30,
"timeout": 2,
"retries": 3
},
"memory": 256,
"image": "###########.dkr.ecr.eu-central-1.amazonaws.com/nginx:${NGINX_VER}",
"dockerLabels":
{
"Name": "nginx",
"Component": "sidecar-prometheus",
"App-Version": "${NGINX_VER}"
},
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "${LOG_GROUP_NAME}",
"awslogs-region": "eu-central-1",
"awslogs-stream-prefix": "${LOG_GROUP_NAME}"
}
},
"portMappings": [
{
"containerPort": 10000,
"hostPort": 10000,
"protocol": "tcp"
}
],
"mountPoints": [
{
"readOnly": false,
"containerPath": "/config",
"sourceVolume": "VolumeConfig"
}
],
"tmpfs": {
"containerPath": "/var/run",
"size": "50",
"mountOptions": "rw"
},
"tmpfs": {
"containerPath": "/var/cache/nginx",
"size": "50",
"mountOptions": "rw"
},
How can i make the /var/cache/nginx mount rw ?
Many thanks for helping !
2
Answers
The answer is that the config was wrong !
Here is the right way, tmpfs must include in linuxParameters:
Looking at the documentation,
tmpfs
acceptsArray of Tmpfs objects
.You seem to be passing
tmpfs
twice, instead of passing an array. Passing an array properly should work: