使用 composerize 指令將 docker run 指令轉成 docker-compose

若想要把 docker run 轉成 docker-compose 做法如下:

composerize

安裝 npm 然後再裝 composerize cli 

npm install composerize -g to install, and run as such

composerize docker run -p 80:80 -v /var/run/docker.sock:/tmp/docker.sock:ro --restart always --log-opt max-size=1g nginx

產生結果如下:

version: '3.3'
services:
    nginx:
        ports:
            - '80:80'
        volumes:
            - '/var/run/docker.sock:/tmp/docker.sock:ro'
        restart: always
        logging:
            options:
                max-size: 1g
        image: nginx