docker run 参数怎么写进 docker-compose.yml 文件里? - V2EX
GoodRui

docker run 参数怎么写进 docker-compose.yml 文件里?

  •  
  •   GoodRui Feb 26, 2022 2786 views
    This topic created in 1542 days ago, the information mentioned may be changed or developed.

    新手刚开始上手 docker ,在写 docker compose 的 yaml 配置文件时,

    docker run -e MODE=standalone -p 80:80 -it adolfintel/speedtest 

    这种类似 -it 的参数,在 docker-compose.yml 配置文件里怎么表示?搜了好多资料好像也没提到...

    是用

    command: - it 

    这样吗?

    7 replies    2022-02-26 15:55:34 +08:00
    runking
        2
    runking  
       Feb 26, 2022   4
    https://www.composerize.com

    这个可以直接转换
    also24
        3
    also24  
       Feb 26, 2022
    @runking #2
    但是对于楼主给的例子,会直接忽略掉 -it 参数
    amrnxcdt
        4
    amrnxcdt  
       Feb 26, 2022   1
    -it 是 docker cli 的参数。https://docs.docker.com/engine/reference/commandline/run/#examples

    This example runs a container named test using the debian:latest image. The -it instructs Docker to allocate a pseudo-TTY connected to the container’s stdin; creating an interactive bash shell in the container. In the example, the bash shell is quit by entering exit 13. This exit code is passed on to the caller of docker run, and is recorded in the test container’s metadata.
    GoodRui
        5
    GoodRui  
    OP
       Feb 26, 2022
    @also24
    @runking
    感谢两位热心 v 友,#1 让我明白了原理,#2 找到了好用捷径!
    GoodRui
        6
    GoodRui  
    OP
       Feb 26, 2022
    @also24 这个命令是这个 speedtest 的官方给的启动方式啊...具体还不理解为什么加-it...
    also24
        7
    also24  
       Feb 26, 2022
    @GoodRui #6
    我…………

    我本来想发 2 楼的站的,测试了一下发现会忽略 -it 参数,还以为你是强需求,于是贴了 1 楼的链接……
    About     Help     Advertise     Blog     API     FAQ     Solana     1058 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 32ms UTC 18:38 PVG 02:38 LAX 11:38 JFK 14:38
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86