linux - 将 Docker run 的参数添加到 docker-compose

标签 linux docker selenium docker-compose yaml

我正在运行此命令来启动 selenium 镜像并运行我的容器:

sudo docker run -d -p 4445:4444 --shm-size 2g selenium/standalone-firefox:latest
我想将此命令集成到我的 docker-compose 文件中,因此我执行了以下操作:
  selenium:
    image: selenium/standalone-firefox:latest
    container_name: selenium
    restart: on-failure
    ports:
     - 4445:4444
但我还需要传递以下参数:--shm-size 2g如何在我的 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'
运行撰写:
docker-compose up
核实:
docker inspect <container-id> | grep ShmSize
            "ShmSize": 2147483648

关于linux - 将 Docker run 的参数添加到 docker-compose,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63710468/

相关文章:

linux - 在 RHEL 服务器上部署 ExtJS

linux - Meld Nautilus 上下文菜单的 Shell 脚本

java - 如何配置spring拦截器以在每个请求中调用

java - TestNG 显示 0 测试运行

java - 自动生成 HTTP 屏幕抓取 Java 代码

linux - 如何调试 "Program received signal SIGSEGV: Segmentation fault"的错误

linux - 如何使用 Linux 命令获取 Ambari HDFS 中文件夹的创建日期?

docker - K6 InfluxDB + Grafana Docker:实际需要哪些文件夹和文件,哪些可以删除?

mysql - "com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure"

selenium - RemoteWebDriver SetFileDetector 给出异常 org.openqa.selenium.UnsupportedCommandException :