You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
ASYD/ASYD_Docker/docker-03/debcp_v5/build.sh

20 lines
471 B

#!/bin/bash
# get the image name from the current working directory
IMG_NAME=$(basename $(pwd))
# create a random container name and use throuout this scrip
CNTR=$(date | md5sum | head -c 10)
docker build -t $IMG_NAME .
# create container without running it
docker create --name $CNTR $IMG_NAME
# copy the file to working directory of the host
docker cp $CNTR:/mydata/greetings.txt .
# remove container again
docker rm $CNTR
# now list new file
ls -l greetings.txt