Preface: Most developers like to be able to write code and rapidly test it, (or "debug" it), in near "real-time". This "write then run, write then run" process may work well on their local system, but things can get complicated when new dependencies get added, or if the developer's system is not the same as "production", or even the same as a "user" environment. Containers can be used to set up the execution environment as it is perceived by the process. This means that a developer can set up a "development environment" within a "container", and then use it to "write then run, write then run" very rapidly, and be confident that the very same container, and very same code, will "run" correctly in another environment.
In this exercise, you have a small "web app" that you are building for Kernelcon, and you are going to use Docker Compose to start your "dev" environment, so that you can easily do your work. This is a VERY common set up...and WAY more common than you may think!
- Change directory so you are in the <REPO_ROOT>/Exercises/Build/Files/build_e2/ directory.
- Run an
ls
command to make sure you are in the correct directory, and you should see:
about.html build_e2.yml dsvw.py index.html
- This is your "development" directory....yeah, you know,...it's where you keep your code ; Now you can make use of Docker Compose to "spin up" your development environment.
- Run the docker-compose command with the definition file.
docker-compose -f build_e2.yml up -d
This will start up a docker container with your app running inside it. Now, navigate to your web browser to view it. You can do this in many ways, but two come to mind: 1) Use either your "host" browser or 2) make use of the firefox browser within kali linux.
To use your host browser (option 1), you will need to find your kali linux IP with a command something like this:
or just find it via the ifconfig eth0
command.
Or, using option 2), again make use of the firefox browser within kali linux:
Then navigate to your new "dev" site: http://127.0.0.1:1234
Or, use your Host browser, if you want http://<kali ip>:1234/
It looks like you (the web developer) forgot to update the site for 2020. Go ahead and edit the file index.html with a program like mousepad or vi (sorry emacs is not installed on kali by default). Then, just refresh your browser.
Have a look around your new dev site. There are some handy "clickable" links and utilities which you will use in another exercise.
docker-compose -f build_e2.yml down