docker_demo/02_simple_dockerfile/02_build_simple.sh

17 lines
467 B
Bash
Executable file

#!/bin/bash
# build the image
docker build -t simple:02 .
# see the image now exists
docker image ls | grep simple
# run interactive container of image
# -i = interactive
# -t = allocate a pseudo tty for interactive shell
# --rm remove the container created by this run command after it exits
docker run -it --rm simple:02 /bin/bash
# alternatively, start the container, print the file, and exit/close the container
# docker run --rm simple:02 cat /cool_file.txt