[英]Add the parameters of Docker run to docker-compose
I am running this command to start a selenium image and run my container:我正在运行此命令来启动 selenium 映像并运行我的容器:
sudo docker run -d -p 4445:4444 --shm-size 2g selenium/standalone-firefox:latest
I would like to integrate this command to my docker-compose file so I did the following which works:我想将此命令集成到我的 docker-compose 文件中,因此我执行了以下操作:
selenium:
image: selenium/standalone-firefox:latest
container_name: selenium
restart: on-failure
ports:
- 4445:4444
But I need to pass on as well the following parameter: --shm-size 2g
但我还需要传递以下参数:-- --shm-size 2g
How can I do that in my docker-compose.yml
file ?我怎样才能在我docker-compose.yml
文件中做到这docker-compose.yml
?
Thanks!谢谢!
Use this docker-compose.yml
:使用这个docker-compose.yml
:
version: '3'
services:
selenium:
image: selenium/standalone-firefox:latest
container_name: selenium
restart: on-failure
ports:
- 4445:4444
shm_size: '2gb'
Run the compose:运行撰写:
docker-compose up
Check it:核实:
docker inspect <container-id> | grep ShmSize
"ShmSize": 2147483648
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.