Primeiro, você precisará obter o comando equivalente docker run
, você pode usar essa ferramenta para fazer isso: link .
Depois de ter o comando docker run
, você pode usar essa outra ferramenta para convertê-lo em um arquivo de composição do docker: link .
Por exemplo:
Eu tenho o seguinte arquivo docker-compose
:
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
Eu corro docker-compose up
e acabo com o seguinte contêiner:
$ 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
Em seguida, gerei o comando docker run
equivalent para o contêiner subjacente:
$ 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
Agora, copie a saída do rekcod e use-a no link para convertê-la em um arquivo de composição do docker:
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'