Giter Site home page Giter Site logo

101-tutorial's Introduction

Docker 101 Tutorial

⚠️ This project is archived. The official "Getting Started" guide can be found at docker/getting-started.

This tutorial has been written with the intent of helping folks get up and running with containers. While not going too much into depth, it covers the following topics:

  • Running your first container
  • Building containers
  • Learning what containers are running and removing them
  • Using volumes to persist data
  • Using bind mounts to support development
  • Using container networking to support multi-container applications
  • Using Docker Compose to simplify the definition and sharing of applications
  • Using image layer caching to speed up builds and reduce push/pull size
  • Using multi-stage builds to separate build-time and runtime dependencies

Getting Started

If you wish to run the tutorial, you can use the following command:

docker run -dp 80:80 dockersamples/101-tutorial

Once it has started, you can open your browser to http://localhost or port 80 if running on Play-with-Docker.

Development

This project has a docker-compose.yml file, which will start the mkdocs application on your local machine and help you see changes instantly.

docker-compose up

By default, the dev container will use the English version of the tutorial. If you wish to work on a different version, modify the services.docs.build.args.LANGUAGE value to the language you want to work in. Note that the build will fail if the steps below (for new languages) haven't been completed yet.

Contributing

If you find typos or other issues with the tutorial, feel free to create a PR and suggest fixes!

If you have ideas on how to make the tutorial better or new content, please open an issue first before working on your idea. While we love input, we want to keep the tutorial is scoped to new-comers. As such, we may reject ideas for more advanced requests and don't want you to lose any work you might have done. So, ask first and we'll gladly hear your thoughts!

Translating the Tutorial

If you wish to translate the tutorial into another language, you need to do the following:

  1. Copy the docs_en directory and rename it as docs_[your-language-code].
  2. Translate each of the directories.
  3. Translate all *.md files
  4. In the mkdocs-config.json, add a key for your-language-code and fill in the remaining pieces to configure the mkdocs build.
  5. To test everything out, you can run the build.sh script, which will verify the config file, as well as build all languages.

101-tutorial's People

Contributors

bretfisher avatar cmtm avatar herrera-luis avatar mikesir87 avatar mkrmpotic avatar peninoule avatar ridono avatar somatorio avatar strund3r avatar sujaypillai avatar wsilva 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

101-tutorial's Issues

Link to Updating Our Application section seems broken

When working through the tutorial, the Updating Our Application section doesn't load after I finish working through the second section of the tutorial. I am doing the tutorial through Play With Docker on the browser instead of Docker Desktop.

build failed by following the tuoturial of docker windows edition 2.3.0.2

I am trying to setup a windows-based docker develop enviornment like this:
windows 10 2004 workstation edition
docker for windows 2.3.0.2 with wsl2 as backend

i following the tutorial like :
step 1 git clone https://github.com/docker/getting-started.git
step 2 docker build -t docker101tutorial .

during the step 2 an exception occoured:

Sending build context to Docker daemon 9.435MB
Step 1/21 : FROM python:alpine AS base
---> 054f329df1c5
Step 2/21 : WORKDIR /app
---> Using cache
---> 3fb6cd766e15
Step 3/21 : COPY requirements.txt .
---> Using cache
---> 5712e1150971
Step 4/21 : RUN pip install -r requirements.txt
---> Using cache
---> e3757ae8c576
Step 5/21 : FROM node:12-alpine AS app-base
---> 7a48db49edbf
Step 6/21 : WORKDIR /app
---> Using cache
---> 8b8fae23197c
Step 7/21 : COPY app/package.json app/yarn.lock ./
---> Using cache
---> 154a104d8200
Step 8/21 : RUN yarn install
---> Running in 9780480d0af9
yarn install v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
error /app/node_modules/sqlite3: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: /app/node_modules/sqlite3
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | x64
node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp info check checked for "/app/node_modules/sqlite3/lib/binding/node-v72-linux-x64/node_sqlite3.node" (not found)
node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.1.0/node-v72-linux-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v72 ABI, musl) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error socket hang up
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
gyp ERR! find Python (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python npm config set python "/path/to/pythonexecutable"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:307:47)
gyp ERR! stack at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:136:21)
gyp ERR! stack at PythonFinder. (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:179:16)
gyp ERR! stack at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:271:16)
gyp ERR! stack at exithandler (child_process.js:310:5)
gyp ERR! stack at ChildProcess.errorhandler (child_process.js:322:5)
gyp ERR! stack at ChildProcess.emit (events.js:310:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
gyp ERR! stack at onErrorNT (internal/child_process.js:469:16)
gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:84:21)
gyp ERR! System Linux 4.19.84-microsoft-standard
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/app/node_modules/sqlite3/lib/binding/node-v72-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/app/node_modules/sqlite3/lib/binding/node-v72-linux-x64" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /app/node_modules/sqlite3
gyp ERR! node -v v12.16.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/app/node_modules/sqlite3/lib/binding/node-v72-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/app/node_modules/sqlite3/lib/binding/node-v72-linux-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack at ChildProcess. (/app/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:310:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp ERR! System Linux 4.19.84-microsoft-standard
node-pre-gyp ERR! command "/usr/local/bin/node" "/app/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /app/node_modules/sqlite3
node-pre-gyp ERR! node -v v12.16.3
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/app/node_modules/sqlite3/lib/binding/node-v72-linux-x64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/app/node_modules/sqlite3/lib/binding/node-v72-linux-x64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
The command '/bin/sh -c yarn install' returned a non-zero code: 1

many thanks

Connection reset on Docker Playground when connecting to base app.

Using the docker playground to run the tutorial and I've run into an issue getting the app to work correctly in the second stage "Our Application".

Steps to reproduce (essentially just follow the instructions):

  1. Launch a Docker Playground instance.
  2. Run the command docker run -dp 80:80 docker/getting-started:pwd (as per https://www.docker.com/101-tutorial )
  3. Connect to the tutorial by opening port 80 (click the link there)
  4. Download the app.zip file from the tutorial.
  5. Upload the zip file to the playground instance and unzip.
  6. Create the Dockerfile following the instructions.
  7. Build the docker image.
  8. Start the container running.
  9. Attempt to connect to the app.

Expected result: Connecting to the node todo app.
Actual result: Connection reset error.

I assume the difference between running the tutorial locally and in the playground is the reason for the differences in the image files (the :pwd at the end.)

I've tried this running on a separate instance from the main tutorial, even changing the port to 80 in case of some weird playground firewall (because that port works for the tutorial itself.) Even attempting to connect locally to the port (within the playground) results in errors (e,g, from Curl: curl: (56) Recv failure: Connection reset by peer)

Error when run the tutorial

$ docker run -p 80:80 dockersamples/101-tutorial 
2020/05/26 03:31:09 [emerg] 1#1: open() "/etc/nginx/nginx.conf" failed (13: Permission denied)
nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (13: Permission denied)

Muti-Container Apps: get out of netshoot

In chapter of Multi-Container Apps (highly instructive!) , netshoot is started inside the main PWD command prompt to show off easy networking. Thats great.

You may want to mention that typing 'exit' at the netshoot prompt is the way to get out to 'your own' prompt again, as ctrl-C, ctrl-Z or ctrl-D do not do the trick.

Docker-101: Tutorial - Node Application does not open on port 3000.

I was following the Docker 101 tutorial on the Docker Playground and reached Starting an App Container checkpoint in Our Application section.

Screenshot 2020-05-14 at 8 24 20 PM

As directed I hit the docker run -dp 3000:3000 docker-101 command and waited for 3000 badge to appear on PWD interface, but nothing happened the badge never appeared.

Instead, a very long ambiguous number appeared after the command on PWD in Docker Playground.

Screenshot 2020-05-14 at 8 14 22 PM

I even tried manually to access localhost, but all in vain.

Screenshot 2020-05-14 at 8 15 53 PM

MacBook Pro Specs:

  1. MacBook Pro (13-inch, 2017, Two Thunderbolt 3 ports)
  2. Processor 2.3Ghz Dual-Core Intel Core i5
  3. Memory 8 GB 2133 Mhz LPDDR3

OS:

  1. macOS Catalina
  2. version: 10.15.3

Google Chrome:

  1. version: 81.0.4044.138 (Official Build) (64-bit)

I was never able to access the Node To-Do List Application running on port 3000.

Demo Fundamentally Broken

I copy and pasted the code for creating the Dockerfile.

First issue: yarn has changed its commands, it is now "add" instead of "install"

Second Issue: after giving the 'docker build -t docker-101 .' command, the first three steps are successful, but it gives an error at step 4 after it tries to add v1.22.5, saying

"error Missing list of packages to add to your project."

Not exactly inspiring to learn Docker when the tutorial requires so much debugging

Starting a Dev-Mode Container fails

All goes well in the tutorial until I try to run sh -c "yarn install && yarn run dev" (e.g. in "Using bind mounts" -> "Starting a Dev-Mode Container", or "Multi-Container Apps" -> "Running our App with MySQL").
And there's not even time to check the logs because the container fails to start.
Any idea on how to debug and fix this?
Thanks !

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.