Other Dockerfile instructions
- Instructions which we are aware as of now
- Other instructions
- WORKDIR: Changes default working directory
FROM alpine WORKDIR bin # build a image docker image build -t testing:1.0 . docker container run --name test3 -d testing:1.0 sleep 1d docker container exec test3 pwd # bin/ Also try tomcat:8
- They are used to set the values while building the image
- To set the variable with Value, so that you can use the value while building the image & Change the value if required while container is created.
- ENV values become environment variables in your Docker container.
- This will set the USER Name
- Execute the folllowing instructions & Make a note of Results
FROM alpine docker image build -t usertest:1.0 docker container run -d --name test1 usertest:1.0 sleep 1d docker container exec test1 whoami FROM alpine USER test docker image build -t usertest:2.0 docker container run -d --name test2 usertest:2.0 sleep 1d docker container exec test2 whoami
Multi Staged Docker Image Building
- Creating optimized Docker images is why we use multi stage builds
- Multi stage builds can be directly integrated with CI/CD