Docker
Tutorial. Getting Started
Sample Application
For the rest of this tutorial, we will be working with a simple todo list manager that is running in Node.js. If you’re not familiar with Node.js, don’t worry. No real JavaScript experience is needed.
- Docker Docs: Sample application
- Repo docker/getting-started
- The folder with this app
Node.js Docker Tutorial
The Node.js getting started guide teaches you how to create a containerized Node.js application using Docker. In this guide, you’ll learn how to:
- Create a simple Node.js application
- Create a new Dockerfile which contains instructions required to build a Node.js image
- Run the newly built image as a container
- Set up a local development environment to connect a database to the container
- Use Docker Compose to run the Node.js application
- Configure a CI/CD pipeline for your application using GitHub Actions.
- After completing the Node.js getting started modules, you should be able to containerize your own Node.js application based on the examples and instructions provided in this guide.
Using Jekyll with Docker
File docker-compose.yml
:
version: '3'
services:
site:
image: jekyll/jekyll:3.8.6
command: bundle exec jekyll serve --future --incremental --watch --livereload --drafts --host 0.0.0.0 --port 4000
ports:
- 4000:4000
volumes:
- .:/srv/jekyll
- ./vendor/bundle:/usr/local/bundle
En el Rakefile
:
task :docker do
# sh 'docker run --rm --volume="$PWD:/srv/jekyll" --volume="$PWD/vendor/bundle:/usr/local/bundle" --env JEKYLL_ENV=development -p 4000:4000 jekyll/jekyll:3.8 jekyll serve'
sh 'docker compose up'
end
o bien:
➜ apuntes git:(main) ✗ cat jekyll-up
#!/bin/bash
docker compose up
➜ apuntes git:(main) ✗ cat jekyll-down
#!/bin/bash
docker compose down
References
- docker/getting-started en GitHub
- docker/getting-started en Docker
- Demystifying Containers - Part I: Kernel Space medium blog
- Containers From Scratch An amzing intro to Containers by Liz Rice in GOTO 2018