If you are looking for to learn Docker, following a hello exercise to help you with it.
- Let’s create a test file:
$ cat myfile.txt
Hello world !!
- Now, let’s create an our Dockerfile which defines our image
$ cat Dockerfile
FROM ubuntu:18.04
COPY myfile.txt ${HOME}/myfile.txt
ENV MYTEST=”worked”
- Then, the following command will build our image:
docker build . -t docker-demo:0.0.1
- Now, check our image due running with:
docker run -it docker-demo:0.0.1 bash
See that the myfile.txt was copied from our local machine to the docker image by executing $ ls
as the env was created due $echo $MYTEST
.
After that, see the following posts for a further understanding: