docker-compose for Detached mode

0 votes

I have the following command to run the container

docker run -d --name test -v /etc/hadoop/conf:/etc/hadoop/conf -v /usr/lib/python2.7/dist-packages/hdinsight_common:/usr/lib/python2.7/dist-packages/hdinsight_common -v /etc/hive/conf/:/etc/hive/conf/ -v /etc/tez/conf/:/etc/tez/conf/ -v /usr/hdp/2.4.2.0-258/sqoop/lib/:/usr/hdp/2.4.2.0-258/sqoop/lib/ -i -t hdinsight /bin/bash

But it was getting unnecessarily complex for me. So, I ended up creating a composer file as below

version: '2'
services:
  hdinsight:
    image: hdinsight
    container_name: ABC
    volumes:
     - /etc/hadoop/conf:/etc/hadoop/conf
     - /usr/lib/python2.7/dist-packages/hdinsight_common:/usr/lib/python2.7/dist-packages/hdinsight_common
     - /etc/hive/conf/:/etc/hive/conf/
     - /etc/tez/conf/:/etc/tez/conf/
     - /usr/hdp/2.4.2.0-258/sqoop/lib/:/usr/hdp/2.4.2.0-258/sqoop/lib/
    entrypoint:
     - bash
    labels:
     - "HDInsight client VM"

However, I am unclear on where to pass the -d/ -i/ -t flags within my original docker run command 

Previously I ran my compose like this

docker-compose -f docker-compose.yml run hdinsight

Need some help in being pointed in the right direction

Apr 20, 2022 in Docker by pranav
• 2,590 points
1,223 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
You should look over the Compose file documentation.
Compose equivalents exist for most docker run commands, and they should all be put there.

After run or up, the background flag -d is used.

Because docker-compose run accomplishes this by default, the tty flag -t and interactive flag -i are not required. You can use -t to add tty to individual containers in the compose file, but you won't be able to utilise interactive mode because numerous containers may be started at once and you won't be able to interact with them all.

The command you're using should be functioning in your circumstance. The -d option following the run command causes it to execute in the background. However, I prefer using up rather than run because it will start all containers in the file without requiring you to specify hdinsight.
answered Apr 27, 2022 by Abhijeet
• 180 points

edited Mar 5

Related Questions In Docker

0 votes
1 answer

Can you use docker-compose files to start services in Docker 1.12 swarm-mode?

Yess, you can. you must download/install the ...READ MORE

answered Aug 10, 2018 in Docker by Kalgi
• 52,350 points
903 views
0 votes
1 answer

Docker-Compose with Docker 1.12 “Swarm Mode”

you can run docker service commands on ...READ MORE

answered Aug 10, 2018 in Docker by Kalgi
• 52,350 points
898 views
+1 vote
4 answers

Docker Compose wait for container X before starting Y

You can use the depends_on feature was ...READ MORE

answered May 7, 2019 in Docker by Kunal
11,634 views
0 votes
1 answer

How to update docker-compose on Docker for Windows?

Please check "version" value in the docker-compose.yml ...READ MORE

answered Sep 21, 2018 in Docker by Tyrion anex
• 8,700 points
3,713 views
0 votes
1 answer

Is it possible to use JSON instead of YAML for docker-compose file?

You can use JSON instead of YAML ...READ MORE

answered Jul 2, 2019 in Docker by Sirajul
• 59,230 points
5,186 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,020 points
2,863 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP