Creating multiple directories with docker run

When running the following in a terminal on my Linux machine:

mkdir -p /tmp/storage/{logs,framework,app}

      

Create the following directories:

/tmp/storage/app
/tmp/storage/framework
/tmp/storage/logs

      

When building using RUN

, one directory is created in the Dockerfile:

/tmp/storage/{logs,framework,app}

      

I know I can just create multiple RUNs each with a mkdir

pr directory , but I'm curious why the other command doesn't work and if there is a way to do it?

+3


source to share


1 answer


RUN

commands are used /bin/sh

, while you are most likely using /bin/bash

on the terminal. To get Bash behavior, use Bash:



RUN bash -c 'mkdir -p /tmp/storage/{logs,framework,app}'

      

+6


source







All Articles