Skip to main content
added generated docker-compose file
Source Link

E.g.:

I have the following docker-compose file:

version: '2'
services:
  logstash:
    image: docker.elastic.co/logstash/logstash:5.6.3
    ports:
      - 9600:9600
    volumes:
      - ./pipeline/logstash.conf:/usr/share/logstash/pipeline/logstash.conf
      - ./config/:/usr/share/logstash/config

I run docker-compose up and end up with the following container:

$ docker ps

CONTAINER ID        IMAGE                                       COMMAND                  CREATED             STATUS              PORTS                              NAMES
5febb7edb627        docker.elastic.co/logstash/logstash:5.6.3   "/usr/local/bin/dock…"   2 minutes ago       Up 2 minutes        5044/tcp, 0.0.0.0:9600->9600/tcp   logstash563_logstash_1

Then, I generate the docker run equivalent command for the underlying container:

$ rekcod 5febb7edb627

docker run --name logstash563_logstash_1 -v /workplace/mariodes/docker/logstash/logstash-5.6.3/pipeline/logstash.conf:/usr/share/logstash/pipeline/logstash.conf:rw -v /workplace/mariodes/docker/logstash/logstash-5.6.3/config:/usr/share/logstash/config:rw -p 9600:9600/tcp --net logstash563_default --restart no -h 2392ddc1cea7 --expose 5044/tcp --expose 9600/tcp -e 'PATH=/usr/share/logstash/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' -e 'ELASTIC_CONTAINER=true' -e 'LANG=en_US.UTF-8' -e 'LC_ALL=en_US.UTF-8' -d --entrypoint "/usr/local/bin/docker-entrypoint" docker.elastic.co/logstash/logstash:5.6.3

Now, copy the output from rekcod and use it on https://composerize.com/ to convert it to a docker-compose file:

version: 3
services:
    logstash:
        container_name: logstash563_logstash_1
        volumes:
            - '/workplace/mariodes/docker/logstash/logstash-5.6.3/pipeline/logstash.conf:/usr/share/logstash/pipeline/logstash.conf:rw'
            - '/workplace/mariodes/docker/logstash/logstash-5.6.3/config:/usr/share/logstash/config:rw'
        ports:
            - '9600:9600/tcp'
        restart: no
        expose:
            - 5044/tcp
            - 9600/tcp
        environment:
            - 'PATH=/usr/share/logstash/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
            - ELASTIC_CONTAINER=true
            - LANG=en_US.UTF-8
            - LC_ALL=en_US.UTF-8
        entrypoint:
            - /usr/local/bin/docker-entrypoint
        image: 'docker.elastic.co/logstash/logstash:5.6.3'

E.g.:

I have the following docker-compose file:

version: '2'
services:
  logstash:
    image: docker.elastic.co/logstash/logstash:5.6.3
    ports:
      - 9600:9600
    volumes:
      - ./pipeline/logstash.conf:/usr/share/logstash/pipeline/logstash.conf
      - ./config/:/usr/share/logstash/config

I run docker-compose up and end up with the following container:

$ docker ps

CONTAINER ID        IMAGE                                       COMMAND                  CREATED             STATUS              PORTS                              NAMES
5febb7edb627        docker.elastic.co/logstash/logstash:5.6.3   "/usr/local/bin/dock…"   2 minutes ago       Up 2 minutes        5044/tcp, 0.0.0.0:9600->9600/tcp   logstash563_logstash_1

Then, I generate the docker run equivalent command for the underlying container:

$ rekcod 5febb7edb627

docker run --name logstash563_logstash_1 -v /workplace/mariodes/docker/logstash/logstash-5.6.3/pipeline/logstash.conf:/usr/share/logstash/pipeline/logstash.conf:rw -v /workplace/mariodes/docker/logstash/logstash-5.6.3/config:/usr/share/logstash/config:rw -p 9600:9600/tcp --net logstash563_default --restart no -h 2392ddc1cea7 --expose 5044/tcp --expose 9600/tcp -e 'PATH=/usr/share/logstash/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' -e 'ELASTIC_CONTAINER=true' -e 'LANG=en_US.UTF-8' -e 'LC_ALL=en_US.UTF-8' -d --entrypoint "/usr/local/bin/docker-entrypoint" docker.elastic.co/logstash/logstash:5.6.3

Now, copy the output from rekcod and use it on https://composerize.com/ to convert it to a docker-compose file:

version: 3
services:
    logstash:
        container_name: logstash563_logstash_1
        volumes:
            - '/workplace/mariodes/docker/logstash/logstash-5.6.3/pipeline/logstash.conf:/usr/share/logstash/pipeline/logstash.conf:rw'
            - '/workplace/mariodes/docker/logstash/logstash-5.6.3/config:/usr/share/logstash/config:rw'
        ports:
            - '9600:9600/tcp'
        restart: no
        expose:
            - 5044/tcp
            - 9600/tcp
        environment:
            - 'PATH=/usr/share/logstash/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
            - ELASTIC_CONTAINER=true
            - LANG=en_US.UTF-8
            - LC_ALL=en_US.UTF-8
        entrypoint:
            - /usr/local/bin/docker-entrypoint
        image: 'docker.elastic.co/logstash/logstash:5.6.3'
added 122 characters in body
Source Link

IfFirst, you are ablewill need to get the docker runequivalent docker run command ran by composer, you should be ablecan use this tool to do it using: https://github.com/nexdrew/rekcod.

After you have the docker run command, you can use this other tool to convert it to a docker-compose file: https://composerize.com/.

If you are able to get the docker run command ran by composer, you should be able to do it using this tool: https://composerize.com/

First, you will need to get the equivalent docker run command, you can use this tool to do it: https://github.com/nexdrew/rekcod.

After you have the docker run command, you can use this other tool to convert it to a docker-compose file: https://composerize.com/.

Source Link

If you are able to get the docker run command ran by composer, you should be able to do it using this tool: https://composerize.com/