Introduction
this is part 18 from the journey it's a long journey(360 day) so go please check previous parts , and if you need to walk in the journey with me please make sure to follow because I may post more than once in 1 Day but surely I will post daily at least one 😍.
And I will cover lot of tools as we move on.
Docker ignore
if you use git before (if not I will cover it somewhere in the journey) there is .gitignore file where when you push your files to github he will ignore to push files listed in .gitignore same here for docker.
what we should ignore ? maybe some environments files , cached files , node_modules folder .
and for security reasons , let's say you need to safe some api_key locally or login credentials.
Download app_018
if you follow part 9
cd location/DevOpsJourney/
git pull
cd app_018/
replace location with where you put the DevOpsJourney
if your new go to part 9 and do same steps will download old lecture files and new one.
lab
if you clone the repo and go to app_018 you should see our login file already there.
let's create our .dockerignore file
i use vim to it , inside folder app_018
vim .dockerignore
as you see i put .dockerignore and logindata.txt
so when we are going to build he will not copy those to our image that we will build so it's stay locally.
some patterns you may find help full
.git
*.json
location/*.txt
if your project will be uploaded to git you should ignore the .git folder , usually you not gonna see it because every folder start with . will be hidden in linux you can run
ls -a
to see all the files in directory.
*.json , * mean all so here I am telling him ignore all json files
location/*.txt mean ignore all the txt files inside a folder (location is folder name)
build and see
docker image build -t app_018 .
always when you follow me watch out for where i am running my commands , here I am inside ~/Documents/DevOpsJourney/app_018 so to build I need to use . (mean Dockerfile is here in this folder)
docker run --rm --name app_018 -exec -it app_018 sh
ls
as we can see the image does not have the logindata.txt inside , cool!
as challange try to not copy Dockerfile also
Top comments (0)