How to launch Docker Compose and run curl together from dockerfile

Published

Hy guys, I’m newer in Docker. I have a problem with write a dockerfile for my application. My code is beloy:

# define a imagem base
FROM ubuntu:latest

# define a owner image
LABEL maintainer="MyCompany"

# Update a image with packages
RUN apt-get update && apt-get upgrade -y

# Expose port 80
EXPOSE 8089

# Command to start my docker compose file
CMD ["docker-compose -f compose.yaml up -d"]

# Command to link KafkaConnect with MySql (images in docker compose file)
CMD ["curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" 
localhost:8083/connectors/ -d "
{ "name": "inventory-connector",
      "config": { 
            "connector.class": "io.debezium.connector.mysql.MySqlConnector",
            "tasks.max": "1", 
            "database.hostname": "mysql",
            "database.port": "3306",
            "database.user": "debezium",
            "database.password": "dbz",
            "database.server.id": "184054",
            "database.server.name": "dbserver1",
            "database.include.list": "inventory",
            "database.history.kafka.bootstrap.servers": "kafka:9092",
            "database.history.kafka.topic": "dbhistory.inventory"
      }
}"]

I know there can only be one CMD inside the dockerfile file.
How do I run my compose file and then make a cURL call?
I need help for resolve this code. Somebody help me? Thank’s from Brazil!!!

Source: Docker Questions

Answers

Leave a Reply

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq