Amit740
Amit740

Reputation: 199

Executing docker run command from config file

I have several arguments in my docker run command like

docker run --rm -v /apps/hastebin/data:/app/data --name hastebin -d -p 7777:7777 -e STORAGE_TYPE=file rlister/hastebin

Can I put all the arguments of this in a default/config file so that I dont have to mention it explicitly in the run command?

Upvotes: 8

Views: 10700

Answers (1)

Bukharov Sergey
Bukharov Sergey

Reputation: 10185

You can try docker compose

With Compose, you use a Compose file to configure your application’s services. Then, using a single command, you create and start all the services from your configuration

In your case docker-compose.yml file will looks like

version: '2'
services:
   hastebin:
     image: rlister/hastebin
     ports:
       - "7777:7777"
     volumes:
       - /apps/hastebin/data:/app/data
     environment:
       - STORAGE_TYPE=file

And you can run service by command docker-compose up

Upvotes: 4

Related Questions