The Great
The Great

Reputation: 7743

Merge two docker run commands together

I have two docker run commands as given below but I would like to merge these two commands together and execute it.

1st command - Start orthanc just with web viewer enabled

docker run -p 8042:8042 -e WVB_ENABLED=true osimis/orthanc

2nd command - Start Orthanc with mount directory tasks

 docker run -p 4242:4242 -p 8042:8042 --rm --name orthanc -v 
 $(pwd)/orthanc/orthanc.json:/etc/orthanc/orthanc.json -v 
 $(pwd)/orthanc/orthanc-db:/var/lib/orthanc/db jodogne/orthanc-plugins 
 /etc/orthanc --verbose

As you can see, in both the cases the Orthanc is being started but I would like to merge these into one and start Orthanc. When it is started Web viewer should also be enabled and mount directory should also have happened

Can you let me know on how can this be done?

Upvotes: 0

Views: 389

Answers (1)

grapes
grapes

Reputation: 8646

Use docker-compose, it is specially targeted for running multiple containers.

docker-compose.yml

version: '3'
services:
  osimis:
    image: osimis/orthanc
    environment: 
      WVB_ENABLED: 'true'
    ports:
      - 8042:8042

  orthanc:
    image: jodogne/orthanc-plugins
    environment: 
      WVB_ENABLED: 'true'
    ports:
      - 4242:4242
      - 8042:8042
    volumes:
      - ./orthanc/orthanc.json:/etc/orthanc/orthanc.json
      - ./orthanc/orthanc-db:/var/lib/orthanc/db
    command: /etc/orthanc --verbose

and docker-compose up to finish the work

Upvotes: 4

Related Questions