docker build -t myimage:latest -f- . <<EOF FROM centos CMD mkdir /app WORKDIR /app RUN echo "file contents" > file.txt EOF Sending build context to Docker daemon 16.43kB Step 1/4 : FROM centos ---> 470671670cac Step 2/4 : CMD mkdir /app ---> Using cache ---> cf9be82aca00 Step 3/4 : WORKDIR /app ---> Using cache ---> 24baea1f7712 Step 4/4 : RUN echo "file contents" > file.txt ---> Using cache ---> 61db761dc411 Successfully built 61db761dc411 Successfully tagged myimage:latest docker run --name ttt -ti -d --privileged=true myimage "/sbin/init" docker exec -it ttt cat '/app/file.txt' file contents
redirect input into dockerfile
Leave a reply