Coder Social home page Coder Social logo

dylanlrrb / please-contain-yourself Goto Github PK

View Code? Open in Web Editor NEW
608.0 38.0 1.1K 4.58 MB

A Docker tutorial written for people who don't actually know Docker already.

JavaScript 63.65% CSS 20.50% Dockerfile 3.30% EJS 12.55%
docker tutorial tutorials docker-image docker-compose docker-swarm dockerfile container containers containerization

please-contain-yourself's Introduction

Please-Contain-Yourself.


If you have any suggestions for improvements to this guide, find mistakes, or even just notice a spelling or grammar error, please feel free to submit a pull request!

dokerlogo

So. You've heard about this cool thing called Docker.

And suddenly everyone is talking about it, and everyone is using it, and oh-my-gosh what do you mean you're not using it, and do you live in the stone age or something, and you're freaking out because it makes no sense, and you're scouring github for any helpful information about it as you weep and scarf down ice cream and it's dripping on your keyboard and making it all sticky.

No? Just me?

Well, I made this repo as a resource for developers just like me just like YOU, who know that Docker is a powerful tool but have no idea where to start.

It is designed to take you from just knowing "Docker" as a buzzword to utilizing Docker as a really useful tool in development, deployment, and scaling.


Disclaimer. Sort of.

To go through this tutorial you should be comfortable with topics that include, but are not limited to: working in the terminal, git/ version control, servers and ports, horizontal scaling.

The time commitment for this tutorial from start to finish is about 3 hours. Feel free to tackle it in chunks. I do not, however, suggest jumping around the tutorial, the modules build off each other and you're gonna have a bad time if you jump around.

This tutorial is given from the perspective of a Mac user who also has never installed Docker on their machine. We will be working in the terminal A LOT so there might be some quirky little differences in the terminal commands and installation between Mac and Windows. It might take a little more effort on a Window user's part to find functional equivalents to the steps laid out.


WHAT IS DOCKER?

Sure the logo is adorable, but what's all this noise about containers?

Let's get some context by comparing Docker to something that you might be familiar with- Virtual Machines. Virtual Machines are just an emulation of another computer on a computer. Say you have a Windows computer and you wanted to run a program that is only available on Mac; one way you could get around this is by virtually running a Mac on your Windows machine. This works because the Virtual machine wraps the piece of software you want to run in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries, etc.

This 'wrapping everything up into one convenient package' concept is called 'containerization' and Docker containers do something similar with your software, albeit in a very different way. Let me try an analogy to explain. Say you and your sister both wanted to make a sandwich. You want a ham sandwich. She wants a peanut butter and jelly sandwich. Two drastically different sandwiches... but still sandwiches. Using a Virtual Machine to containerize your piece of software would be the equivalent of building an entirely new kitchen in order to accommodate the making of two different sandwiches. By this I mean Virtual Machines include the application, the necessary binaries and libraries, and an ENTIRE guest operating system -- all of which can amount to tens of GBs.

Docker begs the question, why not just share the same kitchen? Containers include the application and all of its dependencies --but share the kernel with other containers, running as isolated processes in user space on the host operating system. Docker containers are not tied to any specific infrastructure: they run on any computer, on any infrastructure, and in any cloud. Check out the neat little picture below that compares a VM (left) to what Docker does (right).

docker

Here's a nice video that talks about this idea in a little more depth.

Because containers share a lot of their resources, they end up being very 'lightweight' so-to-speak; you can spin up a bunch of containers and it's not taxing or resource intensive at all, either memory or processing wise.

Another great feature about containers is that they wrap up everything needed to run; none of its dependancies live outside of itself. For example, that version of node you have running on your machine that you haven't updated in awhile or maybe your operating system. The container doesn't care because it doesn't use those. So if it works on your computer, it will work on your friend's computer, it will work on the cloud, it will work everywhere. The days of saying "Well it worked on my computer, I don't know why it's breaking on yours" are over!

Hopefully I've enticed you to spend some time learning this really cool tool... if so, the first steps on your journey to Docker mastery are outlined below ->

Tutorial Roadmap

Start at the first module. Unless you've already completed it. In that case ignore me, whatever.

  • Module 1 Installation and Introduction
  • Module 2 Long Lived Containers
  • Module 3 Bundle Your App into an Image
  • Module 4 Containerized Development With Volumes
  • Module 5 Make Multiple Containers Work Together

Modules 6 and above contain more advanced content. Dive in with these Modules if you've been wanting to sink your teeth into the really juicy parts of Docker!

**Modules with a line through are still in production and not ready yet; check back soon or hit the 'Watch' button on this repo to be notified when the modules become available!


Resources:

please-contain-yourself's People

Contributors

alexharb avatar courtchao avatar craigquincy avatar cschucode avatar daneparke avatar dylanlrrb avatar evelyncc avatar jessbonanno avatar joshuahlee avatar jscholar avatar jykim16 avatar kimbyongjin avatar lukwallace avatar pjminer3 avatar rykuehn avatar sean-oneal avatar ugudei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

please-contain-yourself's Issues

Module 4 [error] - Dockerfile: RUN yarn global add nodemon

I was working through your tutorial and ran into this error when building the image from the Dockerfile
$ docker build -t colorserver .

stack trace:

 => ERROR [6/6] RUN yarn global add nodemon                                                                                5.5s
------
 > [6/6] RUN yarn global add nodemon:
#10 1.191 yarn global v1.5.1
#10 1.396 [1/4] Resolving packages...
#10 3.586 [2/4] Fetching packages...
#10 5.396 error [email protected]: The engine "node" is incompatible with this module. Expected version ">=10".
#10 5.400 error An unexpected error occurred: "Found incompatible module".
#10 5.403 info If you think this is a bug, please open a bug report with the information provided in "/usr/local/share/.config/yarn/global/yarn-error.log".
#10 5.403 info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.
------
executor failed running [/bin/sh -c yarn global add nodemon]: exit code: 1

I would suggest updating the node version in the docker file to FROM node:14-alpine.

I attempted to create a pull request, but was unable to access. Thanks for the tutorial!

Readme.md for 5-Make_Multiple_Containers_Work_Together

Hi,

For the tutorial in the read me for 5-Make_Multiple_Containers_Work_Together

The instructions to build the containers ( EX: docker build -t results . ) should come after the reader changes directories into the directories where those Dockerfile's live, which is about 30 lines more down the page.

Connor

Modules 5 and 6: Latest MongoDB container not compatible with reqests from results_server and survey_server.

The newest release of MongoDB does not support the queries made by the version of the Mongoose library in the results_server and survey_server in modules 5 and 6.

The containers start ok, but whenever attempting to submit a new entry from the form at localhost:8080, the survey_server crashes with the following error message:

MongoError: Unsupported OP_QUERY command: insert. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal

Attempting to visit localhost:3000 yields the error Cannot read property 'length' of undefined.

After some digging, it appears that these legacy opcodes were deprecated in MongoDB 5.0 and removed in MongoDB 6.0. While I can't find them mentioned in the index.js files, the database queries must be using these opcodes.

Possible Solutions:

  1. Set the version of the MongoDB container to 4.0, instead of using mongo:latest to pull it. Pull request #56 addresses this issue, though at time of writing it only modifies the README in module 5 and doesn't fix the docker_compose.yml file in module 6.
  2. Rewrite the code using the Mongoose library code with their newer methods. According to the warnings from the console, several methods from Mongoose are deprecated and should no longer be used.

Confusing statement in part 5

I love the tutorial, but this doesn't make sense to me at all:

layering a ton of images into one massive image that spins up into a multi-functional container is not efficient. The great thing about containers is that it tricks the computer into using it's un-utilized processing power to run many more containers at the same time than it would if they were regular pieces of software, thus getting more 'bang for your buck' out of the host machine (so-to-speak). Having your entire app's functionality in one container wastes all that precious processing power Docker could have been squeezing out of the host if you otherwise separated your app into discrete, containerized microservices.

How does splitting up different services into different containers make better use of processing power than if you packed the services into one container? Are there restrictions on multithreading/processing in docker? If so, worth explaining.

Please-Correct-Yourself

It's "semantic", not "symantec". Symantec is a corporation that creates cybersecurity software, and you're just killing me.

Referring, of course, to this at the top of each of your modules: "A note about the symantec formatting in this tutorial..."

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.