My understanding here is that you would like to increase memory in /dev/shm in the container. As you stated and per this
Stackoverflow post, it is possible if you run the docker command and after you build and SSH to the VM instance. Now, if you are looking to automate it while creating the VM, and assuming you are using a
container optimized image (COS) for a
single container, you may try passing the argument to an
entrypoint command or an
environment variable. My understanding of the Stackoverflow post is that running the command is not the best way as the container might restart and you lose this config. Hence, another method even when using other operating systems is to use
startup scripts to automate installing
docker packages and maybe using
docker compose to build the container with the desired "shm_size" and per the same Stackoverflow post.
However, if your end objective is to mount an empty tmpfs (RAM-backed filesystem), maybe using this
method would better serve your use-case.