从configuration文件执行docker run命令

在我的泊坞窗运行命令中有几个参数

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

我可以把所有这些参数放在一个默认的/configuration文件,所以我不必在运行命令中明确提到它?

你可以尝试docker撰写

通过撰写,您可以使用撰写文件来configuration您的应用程序的服务。 然后,使用单个命令创build并启动configuration中的所有服务

在你的情况下docker-compose.yml文件将如下所示

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

你可以通过docker-compose up command命令来运行服务