Dockerfile
FROM debian:buster ADD run.sh /tmp/run.sh RUN /tmp/run.sh
run.sh
#!/bin/sh echo "testing"
Build
$ sudo docker build -t test . Sending build context to Docker daemon 3.072kB Step 1/3 : FROM debian:buster ---> 26a2b081e032 Step 2/3 : ADD run.sh /tmp/run.sh ---> a082b072b1e6 Step 3/3 : RUN /tmp/run.sh ---> Running in 6c924b40741d testing Removing intermediate container 6c924b40741d ---> b76fb3f49f09 Successfully built b76fb3f49f09 Successfully tagged test:latest
參數-t代表TAG名稱
$ sudo docker images REPOSITORY TAG IMAGE ID CREATED SIZE test latest b76fb3f49f09 18 seconds ago 114MB