Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcloud: add docker run arguments while deploy docker container to GCE

I need to add --shm-size command to docker run while I deploy container image from Container Registry.

According to documentation I need to use Arguments fields under Advanced container options but it doesn't work for me. I've added --shm-size 1G line like that:

enter image description here

docker exec -it 68d... df -h still returns default shm size:
shm 64M 0 64M 0% /dev/shm

Could somebody suggest how can I solve my issue?
I also have tried to increase it manually inside docker container but faced mount: /dev/shm: permission denied. issue.

UPDATE
Solution:
I've created a bash script as an entry point which is set up /dev/shm size manually:

#!/bin/bash
echo "none /dev/shm tmpfs defaults,size=500m 0 0" >> /etc/fstab 
mount -o remount /dev/shm

dotnet Worker.dll

Dockerfile:

....
USER root
COPY ["Worker/start.sh", "app/"]
CMD ["/bin/bash", "app/start.sh"]
like image 614
kkost Avatar asked Nov 19 '25 05:11

kkost


1 Answers

Arguments under the advance container option is just like passing arg to ENTRYPOINT. Query compute metadata "gce-container-declaration" using command from the container vm 'curl -H "Metadata-Flavor: Google" "http://metadata.google.internal/computeMetadata/v1/instance/attributes/gce-container-declaration"'

For your use case, create non-container VM, then install the docker yourself and run a container using our docker shm arg

like image 120
Ajit Singh Avatar answered Nov 21 '25 00:11

Ajit Singh