Giter VIP home page Giter VIP logo

getting-started's Introduction

Docker Getting Started Tutorial

This tutorial was written with the intent of helping folks get up and running with containers and is designed to work with Docker Desktop. 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 containers
  • 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 after installing Docker Desktop:

docker run -d -p 80:80 docker/getting-started

Once it has started, you can open your browser to http://localhost.

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

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 want to suggest adding new content, please open an issue first before working on your idea. While we love input, we want to keep the tutorial 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!

getting-started's People

Contributors

amims71 avatar angellozan avatar antalvarenga avatar awhite avatar biancapower avatar chulijimmi avatar coreygarvey avatar craig-osterhout avatar dependabot[bot] avatar dmahnkopf avatar erichays avatar ffe4 avatar geehon avatar gjungb avatar glours avatar gomolemoongithub avatar harunkilic avatar ideskov avatar klintzz avatar lunelson avatar mat007 avatar mattlevan avatar mikesir87 avatar muescha avatar nebuk89 avatar notunlikethewaves avatar ollyhowell avatar patil2099 avatar stefanscherer avatar zuccamia 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

getting-started's Issues

Error: Cannot find module in "/tutorial/our-application/2

docker build success , but docker run error , dashboard logs:

# success
sudo docker build -t getting-started .
# fail 
sudo docker run -dp 3000:3000 getting-started

emmm ,I try to run the program on my mac is normal sudo node app/src/index.js

internal/modules/cjs/loader.js:960
�������
  throw err;
  ^

Error: Cannot find module '/app/app/node_modules/sqlite3/lib/binding/node-v72-linux-x64/node_sqlite3.node'
Require stack:
- /app/app/node_modules/sqlite3/lib/sqlite3.js
- /app/app/src/persistence/sqlite.js
- /app/app/src/persistence/index.js
- /app/app/src/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/app/app/node_modules/sqlite3/lib/sqlite3.js:4:15)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1019:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/app/app/node_modules/sqlite3/lib/sqlite3.js',
    '/app/app/src/persistence/sqlite.js',
    '/app/app/src/persistence/index.js',
    '/app/app/src/index.js'
  ]
}

Persisting our DB: "Go ahead and remove the first container using the docker rm -f command."

The wording on this line could be improved.

rm -f stops the container and removes the ubuntu image in one step. If you're paying attention you realize this. If you're new to Docker you might gloss over that you're removing the image you created both containers from.

Is it worth reminding the user?

"Let's move on. Stop the container and remove the image with docker rm -f"

getting-started app container stops immediately

Hi,

I am learning docker by following the tutorial in docker/getting-started image. I following the steps as mentioned but when I run my image container it stops with the following logs. I am posting output of the command here

> docker build -t getting-started .
Sending build context to Docker daemon  4.659MB
Step 1/5 : FROM node:12-alpine
 ---> 1f52b7199ba6
Step 2/5 : WORKDIR /app
 ---> Using cache
 ---> dfd91d5abf63
Step 3/5 : COPY . .
 ---> e35813c807c6
Step 4/5 : RUN yarn --install production
 ---> Running in 11960781a554
yarn run v1.22.4
error There are no binary scripts available.
info Project commands
   - dev
      nodemon src/index.js
   - prettify
      prettier -l --write "**/*.js"
   - test
      jest
error No command specified.
Done in 0.02s.
Removing intermediate container 11960781a554
 ---> 9e7b69c3ebe8
Step 5/5 : CMD [ "node", "src/index.js" ]
 ---> Running in 575b099c1f56
Removing intermediate container 575b099c1f56
 ---> 8c9b9efe1096
Successfully built 8c9b9efe1096
Successfully tagged getting-started:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.

> docker run -dp 3000:3000 getting-started
internal/modules/cjs/loader.js:968

throw err;
^
Error: Cannot find module 'express'
Require stack:

- /app/src/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/app/src/index.js:1:17)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/app/src/index.js' ]
}

Named Volume and Shared Volume (windows) -- permissons & git-bash

page: tutorial/using-bind-mounts/

Running Docker Desktop 2.3.0.3 on Windows has a security feature that requires folder permissions, otherwise it will throw errors.

Named volume seems you don't need permission (not sure where that file is, somewhere inside some docker VM?)

For shared volume, you need to add path.

Add them in the settings:

image

When running the commands in git-bash, you have to add //path/ otherwise it will throw errors.

docker run --name todo -dp 3000:3000 --rm \
  -w //app/ -v /${PWD}:/app \
  -v todo-db:/etc/todos \
  node:12-alpine sh -c "yarn install && yarn run dev"

Running in powershell, its fine.

docker run --name todo -dp 3000:3000 `
    --rm `
    -w /app `
    -v ${PWD}:/app `
    -v todo-db:/etc/todos `
    node:12-alpine `
    sh -c "yarn install && yarn run dev"

Permission denied on using-bind-mounts

Recently decided to try and find out more about containers and Dockers. Finding this tutorial well written, however I am finding some difficulty with the following command:
docker run -dp 3000:3000 \
-w /app -v $PWD:/app \
node:12-alpine \
sh -c "yarn install && yarn run dev"

Docker creates an ID, check docker ps - nothing is running

Check docker logs -f <ID> and I see the that permission has been denied:
yarn install v1.22.4

info No lockfile found.

[1/4] Resolving packages...

[2/4] Fetching packages...

[3/4] Linking dependencies...

[4/4] Building fresh packages...

error Could not write file "/app/yarn-error.log": "EACCES: permission denied, open '/app/yarn-error.log'"

error An unexpected error occurred: "EACCES: permission denied, mkdir '/app/node_modules'".

info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

I've been back over the tutorial a couple of times to ensure that I haven't missed a step and as far as I can tell, all steps have been followed.

Running this under Linux. If you need any info, let me know.

Thanks

Todo app fails on startup with docker-compose

Current

In the getting started tutorial, we create the following docker-compose.yml to start the app with mysql:

version: "3.7"

services:
  app:
    image: node:12-alpine
    command: sh -c "yarn install && yarn run dev"
    ports:
      - 3000:3000
    working_dir: /app
    volumes: 
     - ./:/app
    environment:
      MYSQL_HOST: mysql
      MYSQL_USER: root
      MYSQL_PASSWORD: secret
      MYSQL_DB: todos
  mysql:
    image: mysql:5.7
    volumes:
      - todo-mysql-data:/var/lib/mysql
    environment: 
      MYSQL_ROOT_PASSWORD: secret
      MYSQL_DATABASE: todos

volumes: 
  todo-mysql-data:

When running this with docker-compose up -f, the container for the todo application fails.

app_1    | Waiting for mysql:3306................
app_1    | Timeout
app_1    | Error: connect ECONNREFUSED 172.20.0.2:3306

To reproduce the error, run docker-compose up as specified in the tutorial. On some computer, the timeout of 15000ms is reached before the mysql container is fully initialized.

Suggestions

It seems that the app container does not wait long enough for the mysql container to be fully initialized as said in the documentation for mysql container:

If there is no database initialized when the container starts, then a default database will be created. While this is the expected behavior, this means that it will not accept incoming connections until such initialization completes. This may cause issues when using automation tools, such as docker-compose, which start several containers simultaneously.

The app container should wait long enough for the mysql container to be fully running and have a longer timeout or no timeout

Sharing our App: Re-tag, then login to Docker Hub - not before it is necessary

Hello!

I am new to docker and working through these examples currently (in another tab). In the Sharing our App section I became confused.

It asks you to login to Docker Hub before re-tagging the getting-started image to use your Hub username.

This made me believe you needed to be logged in to re-tag an image.

docker tag is a local operation. You can re-tag an image to any name you like, but you would be prevented from pushing if you are not the repository owner.

I am suggesting putting the docker login command immediately before the docker push, not before the docker tag

From this:

  1. Login to the Docker Hub using the command docker login -u YOUR-USER-NAME.

  2. Use the docker tag command to give the getting-started image a new name. Be sure to swap out YOUR-USER-NAME with your Docker ID.

docker tag getting-started YOUR-USER-NAME/getting-started

  1. Now try your push command again. If you're copying the value from Docker Hub, you can drop the tagname portion, as we didn't add a tag to the image name. If you don't specify a tag, Docker will use a tag called latest.

docker push YOUR-USER-NAME/getting-started

To this:

  1. Use the docker tag command to give the getting-started image a new name. Be sure to swap out YOUR-USER-NAME with your Docker ID.

docker tag getting-started YOUR-USER-NAME/getting-started

  1. Login to the Docker Hub using the command docker login -u YOUR-USER-NAME.

  2. Now try your push command again. If you're copying the value from Docker Hub, you can drop the tagname portion, as we didn't add a tag to the image name. If you don't specify a tag, Docker will use a tag called latest.

docker push YOUR-USER-NAME/getting-started

Host in volume?

In the "Persisting our Todo Data" section:

By creating a volume and attaching (often called "mounting") it to the directory the data is stored in, we can persist the data. As our container writes to the todo.db file, it will be persisted to the host in the volume.

I'm confused by the last few words. It seems to me that you are saying the host has been or will continue to be in the volume.

Do you mean to instead say something like:

When our container writes to the todo.db file and is subsequently stopped, this file will be persisted via the volume to the host.

connection to localhost:3000 is refused

In 'Our application' > 'Starting an app container' > step 1 I'm instructed to run docker run -dp 3000:3000 getting-started, then wait a few seconds before opening localhost:3000 in my browser. I'm only getting the ERR_CONNECTION_REFUSED.
I tried this on Chrome Version 87.0.4280.66 (Official Build) (64-bit) on Ubuntu 19.10.

Update: when I list running containers, I see that the container is exited with status 1.

Here is the inspect output for the image:

[
{
"Id": "sha256:a1e0004f8758699df21f8c4b663939e16c844d940a6c6d6b694ee122df0f6309",
"RepoTags": [
"getting-started:latest"
],
"RepoDigests": [],
"Parent": "sha256:e01ebf9ad6c4f04816b9c35ffca63fcb21f75ace58991d0784b595b1147b0960",
"Comment": "",
"Created": "2020-12-06T14:02:31.856616491Z",
"Container": "428e5218f56c97e89541ae6e52d683e6c98b77b0b0a948b0c1b22a237674f630",
"ContainerConfig": {
"Hostname": "428e5218f56c",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"NODE_VERSION=12.20.0",
"YARN_VERSION=1.22.5"
],
"Cmd": [
"/bin/sh",
"-c",
"#(nop) ",
"CMD ["node" "scr/index.js"]"
],
"Image": "sha256:e01ebf9ad6c4f04816b9c35ffca63fcb21f75ace58991d0784b595b1147b0960",
"Volumes": null,
"WorkingDir": "/app",
"Entrypoint": [
"docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": {}
},
"DockerVersion": "19.03.12",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"NODE_VERSION=12.20.0",
"YARN_VERSION=1.22.5"
],
"Cmd": [
"node",
"scr/index.js"
],
"Image": "sha256:e01ebf9ad6c4f04816b9c35ffca63fcb21f75ace58991d0784b595b1147b0960",
"Volumes": null,
"WorkingDir": "/app",
"Entrypoint": [
"docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": null
},
"Architecture": "amd64",
"Os": "linux",
"Size": 179584187,
"VirtualSize": 179584187,
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/9128e1a1760052649bdceae056cd11264872e26b88d94a816cc5b4e3d1047b97/diff:/var/lib/docker/overlay2/a835e04f8edf81b5f6dfed3ddf1005ed062cf096f4de0f8a3354a15bf9b9843f/diff:/var/lib/docker/overlay2/d7d2331451bfb1cc9f209cca3d319076d5dc040fa53dbad5267d65604e9f015c/diff:/var/lib/docker/overlay2/b3a47f586ef18dcd71f7b0d86dac6f901f8bf0211b2e544f96b6d313c62b7a05/diff:/var/lib/docker/overlay2/a73177b28922fed76634c09abac46db9ccd21cffdbe3a68d5d7ad2ad6727be63/diff:/var/lib/docker/overlay2/ee97ac5a02d39d222fbeb0d6dddf4a3b645ecb09e41ea325d2d43802688f5aff/diff",
"MergedDir": "/var/lib/docker/overlay2/722eebaf40acdabf6cd5a9be926497079e142503f6927f41f978c5cb128c9191/merged",
"UpperDir": "/var/lib/docker/overlay2/722eebaf40acdabf6cd5a9be926497079e142503f6927f41f978c5cb128c9191/diff",
"WorkDir": "/var/lib/docker/overlay2/722eebaf40acdabf6cd5a9be926497079e142503f6927f41f978c5cb128c9191/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:3e207b409db364b595ba862cdc12be96dcdad8e36c59a03b7b3b61c946a5741a",
"sha256:996fa7c6680b261d244ddf4c3982fdd673799088fb146aafd2230d726756263c",
"sha256:f2253cc2dbde740009ebb90005f018e151d5a1686c18922e5550d6ce7f379aaa",
"sha256:7df30886016b5e8643d398d988795516127d6e5c58393606f893ec18bf627af1",
"sha256:1820ee94675aaf073f15153cb1bb58e82ca524223c16d9e818b0fd1a63b76edf",
"sha256:1969ea02f942e0ad2e6bbe1ce73c5ac1f0693f45f630303bfafc91019813686b",
"sha256:68137fb3ff556e5b1dc0262d36a1518d47dbaf284508eb01bdffe881230147ee"
]
},
"Metadata": {
"LastTagTime": "2020-12-06T15:17:47.995549174+01:00"
}
}
]

docker-compose up doesn't finish building

When we do docker-compose up, we have this error and the image build doesn't succeed.

Building wheel for regex (setup.py): finished with status 'error'
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-qa4vb56a/regex/setup.py'"'"'; __file__='"'"'/tmp/pip-install-qa4vb56a/regex/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-1v4h04at
       cwd: /tmp/pip-install-qa4vb56a/regex/
  Complete output (17 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.8
  creating build/lib.linux-x86_64-3.8/regex
  copying regex_3/__init__.py -> build/lib.linux-x86_64-3.8/regex
  copying regex_3/regex.py -> build/lib.linux-x86_64-3.8/regex
  copying regex_3/_regex_core.py -> build/lib.linux-x86_64-3.8/regex
  copying regex_3/test_regex.py -> build/lib.linux-x86_64-3.8/regex
  running build_ext
  building 'regex._regex' extension
  creating build/temp.linux-x86_64-3.8
  creating build/temp.linux-x86_64-3.8/regex_3
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.8 -c regex_3/_regex.c -o build/temp.linux-x86_64-3.8/regex_3/_regex.o
  unable to execute 'gcc': No such file or directory
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for regex
  Running setup.py clean for regex

We think some Python dependencies have changed recently, that cause this problem.

Screen Shot 2020-04-14 at 10 23 01 AM

Could we have a workaround for this? Thank you in advance.

[email protected]: The platform "linux" is incompatible with this module.

On building the todo list app it appears there is an issue with the fsevents module when running on windows (containers in linux mode).

[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...

---additional information---
G:\Docker\DockerDesktop\TutorialApp\app>docker version
Client: Docker Engine - Community
Version: 19.03.8
API version: 1.40
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:23:10 2020
OS/Arch: windows/amd64
Experimental: false

Server: Docker Engine - Community
Engine:
Version: 19.03.8
API version: 1.40 (minimum version 1.12)
Go version: go1.12.17
Git commit: afacb8b
Built: Wed Mar 11 01:29:16 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683

G:\Docker\DockerDesktop\TutorialApp\app>systeminfo
(redacted)
OS Name: Microsoft Windows 10 Enterprise
OS Version: 10.0.18362 N/A Build 18362
System Manufacturer: Gigabyte Technology Co., Ltd.
System Model: Z270M-D3H
System Type: x64-based PC
Processor(s): 1 Processor(s) Installed.
[01]: Intel64 Family 6 Model 94 Stepping 3 GenuineIntel ~4001 Mhz
BIOS Version: American Megatrends Inc. F7, 16/11/2017
Total Physical Memory: 65,496 MB

G:\Docker\DockerDesktop\TutorialApp\app>

Problem completing "Bind Mounts" section of this tutorial

Hello! I am very much enjoying learning docker through this getting-started tutorial. However, I am having problems completing the Bind Mounts section. It seems the following command is invalid (what is the $PWD doing?):

docker run -dp 3000:3000 \
    -w /app -v $PWD:/app \
    node:12-alpine \
    sh -c "yarn install && yarn run dev"

Also, there do not seem to be full front to back steps on what to do after running this command (which causes an error on my terminal session):

docker: invalid reference format: repository name must be lowercase.

If someone could look into this that would be great - because I've already learned a lot in the first several steps!

Thank you much -
Andrew

ToDo App (localhost:3000) shows no UI in Browser

When I start the container with the node app, everything looks fine, but upon navigating to localhost:3000 the browser window is empty (see screenshot):

Capture

The logs contain exactly two lines:

Using sqlite database at /etc/todos/todo.db Listening on port 3000

This is on Docker Desktop CE Stable for WIndows 2.2.0.5, Docker Desktop CE Edge 2.2.3.0 under Windows 10 Pro 2004 and Windows 10 Enterprise 19.03. Tested with Chrome, Firefox, and Edge (all latest versions).

Persisting our DB: Is there a better way to keep a container from exiting?

In this section it is demonstrated that 2 separate instances of the same image do not share files. You are instructed to run:

docker run -d ubuntu bash -c "shuf -i 1-10000 -n 1 -o /data.txt && tail -f /dev/null"

This seemed odd. I was reminded of when I first started programming and I was taught several different ways to keep a program running (like the above), and others using sleep() or even a busy for-loop. They all have their problems.

I went Googling and there are several ways this is being done by the community. I could not find The Right Answer. Is there an official, recommended way to keep a container running? This one relies on having tail available.

I think this could be improved because it otherwise instills 1 way as "The Way" for people who are very new to Docker.

(me)

Updating our App: Reminder to stop and/or remove the 2nd, port 3000 image

Hello!

I'm working through these exercises right now as someone new to docker.

At the end of "Updating our App", it would be good to have a reminder telling the user to stop the 2nd, port 3000 image and then potentially remove it. I forgot this and it does not seem like this image is re-used in later exercises.

(still getting to the finish)

Getting starting command mismatch

I did a clean install of Docker Desktop for Windows and I noticed the get started command in the dashboard is the one below:
docker run -dp 80:80 docker/getting-started

Running the command and then navigating to the Getting Started page of the running container breaks down this command:
docker run -d -p 80:80 docker/getting-started

It is a relatively small variance using -dp vs -d -p but could be confusing to newcomers. Any ideas on how we could make this a little better? I am happy to create a PR for it.

Bind Mounts on windows not working

I'm trying to understand why i cant execute this command, i'm currently inside getting-started\app (on Windows) and i get errors:

docker run -dp 3000:3000 \ -w /app -v "$(pwd):/app" \ node:12-alpine \ sh -c "yarn install && yarn run dev"

This opens a message saying docker wants to access: C:\PATH\getting-started\app;C (with the weird ;C at the end)

If i change the code in this way it goes away:
-w //app -v "$(pwd)://app" \

it starts a container which gets closed immediatly with an error:
error Couldn't find a package.json file in "/app"

I don't understand why, is the dockerfile or the package.json missplaced? I tried to look at other similar issues on github but i was unable to solve my problem.

Thank you!

UPDATE:
Asked a friend, seems like there is a problem with paths that has to be written not in windows style:
So from getting-started/app i did:

docker run -dp 3000:3000
-w //app -v "//c/Users/blabla/app_test/getting-started":/app
node:12-alpine
sh -c "yarn install && yarn run dev"

note the -v has the : in which the host directory is written in a Linux format

note: if in the -w i would put only: -w /app it would trigger an error:
docker: Error response from daemon: the working directory 'C:/Program Files/Git/app' is invalid, it needs to be an absolute path.
(With the weird git path)

Running app through docker-compose doesn't work with default network

Working on Ubuntu 18.04, when I run the app through docker-compose I get nothing in the browser.

Running the two containers from the command line works fine, with the commands below:

~/dev/docker/app$ docker run -d     \
                                  --network todo-app \
                                  --network-alias mysql  \
                                  -v todo-mysql-data:/var/lib/mysql   \
                                  -e MYSQL_ROOT_PASSWORD=secret    \
                                  -e MYSQL_DATABASE=todos    \
                                  mysql:5.7

~/dev/docker/app$ docker run -dp 3000:3000   \
                                  -w /app -v ${PWD}:/app   \
                                  --network todo-app   \
                                  -e MYSQL_HOST=mysql   \
                                  -e MYSQL_USER=root   \
                                 -e MYSQL_PASSWORD=secret   \
                                 -e MYSQL_DB=todos   \
                                 node:12-alpine \
                                 sh -c "yarn install && yarn run dev"

But when I run it using docker-compose, it fails, without any errors (other than the working version). The docker-compose.yml is according to the tutorial:


version: "3.7"

services:
  app:
    image: node:12-alpine
    command: sh -c "yarn install && yarn run dev"
    ports:
      - 3000:3000
    working_dir: /app
    volumes:
      - ./:/app
    environment:
      MYSQL_HOST: mysql
      MYSQL_USER: root
      MYSQL_PASSWORD: secret
      MYSQL_DB: todos

  mysql:
    image: mysql:5.7
    volumes:
      - todo-mysql-data:/var/lib/mysql
    environment: 
      MYSQL_ROOT_PASSWORD: secret
      MYSQL_DATABASE: todos

volumes:
  todo-mysql-data:

The logging output of the mysql container is the same, same warnings. Why don't I see anything in the browser?

mysql database
I can log into the database, using docker exec -it e46fae64e430 mysql -p todos. But they don't point to the same todos database. The 'composer' version is empty, the other contains the test data I entered before.

Max pull request reached at first use

Hello all,
the first action to check if docker is well installed is the docker run hello-world.
But it answers 'You have reached your pull rate limit.'

I'm running as root user on centos 7. My VM is behind a proxy. I've defined the proxy values for http and https in a manually created /etc/systemd/system/docker.service.d directory.

Here is the result of test described here: https://www.docker.com/blog/checking-your-current-docker-pull-rate-limits-and-status/

curl --head -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest 2>&1

HTTP/1.1 200 Connection established

HTTP/1.1 200 OK
Content-Length: 2782
Content-Type: application/vnd.docker.distribution.manifest.v1+prettyjws
Docker-Content-Digest: sha256:767a3815c34823b355bed31760d5fa3daca0aec2ce15b217c9cd83229e0e2020
Docker-Distribution-Api-Version: registry/2.0
Etag: "sha256:767a3815c34823b355bed31760d5fa3daca0aec2ce15b217c9cd83229e0e2020"
Date: Fri, 20 Nov 2020 09:34:31 GMT
Strict-Transport-Security: max-age=31536000
RateLimit-Limit: 100;w=21600
RateLimit-Remaining: 0;w=21600

Bind Mount Command not working

Running the command:

docker run -dp 3000:3000 \ -w /app -v "$(pwd):/app" \ node:12-alpine \ sh -c "yarn install && yarn run dev"

Yields the response:

docker: Error response from daemon: the working directory 'C:/Program Files/Git/app' is invalid, it needs to be an absolute path.

I don't really understand why it is defaulting to the Git directory.

When running the pwd command it does return the correct directory. Any ideas?

Possible typo in Persist Our Todo App

The following line in #2 instruction of Persist Our Todo Data App raised errors until I modified it:
docker run -dp 3000:3000 -v todo-db:/etc/todos getting-started

Here is the modified line:
docker run -dp 3000:3000 -v todo-db:/etc/todos <myuserid>/getting-started

Of course, I used my actual id for <myuserid> :-)

I also cleared out all my containers; don't know if that affected the outcome, or not.

Create CI to build and push docker/getting-started

Just a reminder. We should set up a CI to build and push the docker/getting-started image to Docker Hub.

An empty Dashboard in Docker Desktop suggests to run a container, but I saw that the getting started image is 2 months old. So we probably get issues which are already solved.

Docker Desktop Dashboard without Containers

Persisting Our Data section

It's not clear where a terminal window needs to be opened to see the data.txt file. When I opened a terminal in VS Code at the project level, it couldn't find the data file to cat. I went to the Docker dashboard clicked on open terminal, did and ls, and there was the data file with the random number. It would be helpful if this part were clearer.

Using Bind Mounts: Missing explanation for `-v` option

Hi,
I was going through the tutorial, and for the Using Bind Mounts page, in Starting a Dev-Mode Container, I wasn't able to find a comment/explanation for -v <path> argument for the command in Step 2. Would be nice to have its explanation included along with other arguments.
Thanks!

unclear instructions, hard to start, where to create Dockerfile, how to set the docker working directory

I am new to docker and I try to follow your "Getting started" example and it is not clear what to do:

Building the App's Container Image
Create a file named Dockerfile with the following contents

Where it should be created? In any place? In a specific place?

Build the container image using the docker build command.
docker build -t getting-started .
This command used the Dockerfile to build a new container image.

Where this command should be executed?
in a command line? in a Powershell? in Visual Studio Code?
Why Visual Studio is used in the instruction if it is not used for anything?
How the docker should know wich Dockerfile to use? Does it mean that the Dockerfile should be not anywhere but in a special place?
A file named Dockerfile needs to be created in a special place (where?) and when the command above is called then docker knows which file to use and will build an image which we called "getting-started"?

How the docker should know where the /app directory is located?
Does it mean the docker needs to be started in the directory above the /app directory?
How?
And maybe the Dockerfile also should be located in the directory above the /app directory?

Maybe before calling the docker build -t getting-started . the user should change the directory to the parent folder of the app-folder?

Windows not recognising {PWD} command

I'm trying to follow the tutorial after installing Docker for Windows and I'm struggling on the How to use Bind Mounts section onwards.

The ${PWD} is not working and the multiple lines are not accepted as a single command. I've removed the "" from each line and done it as a single line and made some progress.... but its throwing me.

Grateful for help understanding why I can't use the copy/paste option

Step 7. Multi-Container Apps -> Unable to run App with MySQL!

  • 5 hours of searching with no results.

  • Diagnostic ID: 9EDF4AAE-B34A-4996-9BE0-D4D6310E18D4/202010140151

40
When I enter the following command on windows cmd:
docker run -dp 3000:3000 ^ -w /app -v "cd:/app" ^ --network todo-app ^ -e MYSQL_HOST=mysql ^ -e MYSQL_USER=root ^ -e MYSQL_PASSWORD=secret ^ -e MYSQL_DB=todos ^ node:12-alpine ^ sh -c "yarn install && yarn run dev"

The CMD returns:
9165fe85fbd4c98b9f9455509081252fa89f8f6e072e6caa2651b5a062bc8927 docker: Error response from daemon: driver failed programming external connectivity on endpoint pensive_meitner (97c005c64c2f6ab1dabb8106a3b57285ba610717b36fd3ec82f1c97ad7efa648): Bind for 0.0.0.0:3000 failed: port is already allocated.
StackOverFlow

Starting Dev-Mode container blocks

The following command blocks:

docker run -dp 3000:3000 -w /app -v ${PWD}:/app node:12-alpine sh -c "yarn install && yarn run dev"

I get no output, I see no changes in docker desktop UI, I waited 15 minutes (maybe yarn install takes a while) but I still get nothing and have to stop using Ctrl+C.
I tried running it from a normal command prompt, gitbash and powershell, nothing helps

Add .dockerignore file for node_modules

paragraph: tutorial/image-building-best-practices/#layer-caching

To make use of Layer Caching following Dockerfile for the todo app is proposed:

FROM node:12-alpine
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install --production
COPY . .
CMD ["node", "/app/src/index.js"]

This works as intended but could lead to possibly overwriting modules installed within the image if on the host a node_modules folder already exists and is outdated.

I guess a simple fix would be to add a 1-2 line .dockerignore file like proposed by Node.js.

If You think adding a short introduction into .dockerignore files is not beyond the scope of this tutorial, I would be happy to assist with that.

Using Docker Compose: error Couldn't find a package.json file in "/app

When executing docker-compose up -d, I received this error above when running from the root folder and the app folder. In order to get it to work, I had to add "cd app && yarn install && yarn run dev" to the app service command. Can someone explain what's going on here and is this just a workaround?

Using Bind Mounts: error Couldn't find a package.json file in "/app"

I was having an issue completing the steps in Starting a Dev-Mode Container.

  1. Run the following command (if you are using PowerShell then use this command):

docker run -dp 3000:3000 `
-w /app -v "$(pwd):/app" `
node:12-alpine `
sh -c "yarn install && yarn run dev"

An image ID would be output in the shell, but examining the container using Docker Desktop revealed the container had exited with the following terminal output:

yarn install v1.22.4
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.05s.
yarn run v1.22.4
error Couldn't find a package.json file in "/app"
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I had to update the command in step 2 to the following:

docker run -dp 3000:3000 `
-w /app -v "$(pwd):/app" `
node:12-alpine `
sh -c "cd app && yarn install && yarn run dev"

Is this an appropriate work around?

docker build return error behind proxy

I try to follow the tutorial. I recieved an error on the step 3.
The command build returns an error: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1.
I cannot use pip normally behind a proxy. I always had to use the option pip install -–proxy=user:pass@address.
Is it possible to take this factor into account? At least i wanted to customize the build script myself, to get to the end of the tutorial.
I attached the output of the command.
_out.txt

ToDo app documentation needs clarification

The documentation located on the following link needs some clarifications

http://localhost/tutorial/our-application/
Under "Building the App's Container Image",
1-Should clarify where to create the Dockerfile.
2-Should clarify from which folder to run the build command.

I had downloaded and unzipped the app folder under /docker on my computer.
I had then created the Dockerfile inside the /docker folder and ran the build command from /docker path. It downloaded layers but when I ran docker container ls -ait showed nothing under port. So I couldn't open the app in the browser by going to http://localhost:3000.

I stopped and removed the container and started from scratch, but this time
1-I created the Dockerfile inside the app folder
2-I cd to app folder and then ran the build command.
3-this time running docker container ls -a does show 0.0.0.0:3000->3000/tcp under ports and I was able to open the app in the browser by going to http://localhost:3000.

mysql 5.7 issue and 8+ auth

When trying to setup the mysql database and container with version 5.7 it fails to start. When using 8 or higher, there is an authentication issue since 8 doesnt use the old password method. Is there a way to set up the sql server with a mysql 8 using their new authentication methods?

Problem completing "Bind Mounts" section of this tutorial

Hello, I have followed this tutorial to this part with no problem but, I can't run the command for starting a Dev-Mode container:
Run the following command (replace the \ characters with ` in Windows PowerShell). We'll explain what's going on afterwards:
docker run -dp 3000:3000 \ -w /app -v ${PWD}:/app \ node:12-alpine \ sh -c "yarn install && yarn run dev"

What I have tested:
image

Without the tick ` I get an error stack:
image

Did I miss understood something? Thank you in advance.

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

docker build giving error in "yarn install"

Checking the docker tutorial for building "getting-started" image,

When I executed -
$ docker build -t docker101tutorial .

It gives error:

-------------8<-------------------
yarn install v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz: unable to get local issuer certificate".
info If you think this is a bug, please open a bug report with the information provided in "/app/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
The command '/bin/sh -c yarn install' returned a non-zero code: 1
-------------8<-------------------

When updated the dockerfile with below line before (RUN yarn install) solves the problem.
-------------8<-------------------
RUN yarn config set "strict-ssl" false -g
-------------8<-------------------

Dockerfile should be updated.

unable to access app after docker compose

I followed instruction one by one, once containers were composed using
docker run -d --network todo-app --network-alias mysql -v todo-mysql-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=secret -e MYSQL_DATABASE=todos mysql:5.7

I am unable to login into app using http://localhost:3000

terminal:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\LenovoX\Downloads\app\app> docker build -t getting-started .
Sending build context to Docker daemon 4.689MB
Error response from daemon: the Dockerfile (Dockerfile) cannot be empty
PS C:\Users\LenovoX\Downloads\app\app> docker build -t getting-started .
Sending build context to Docker daemon 4.69MB
Step 1/5 : FROM node:12-alpine
---> 18f4bc975732
Step 2/5 : WORKDIR /app
---> Using cache
---> 10872044b09c
Step 3/5 : COPY . .
---> 0f397df0b22e
Step 4/5 : RUN yarn install --production
---> Running in 6db94dc03cad
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...
Removing intermediate container 6db94dc03cad
Step 5/5 : CMD ["node", "src/index.js"]
---> Running in dff25f6bd75c
Removing intermediate container dff25f6bd75c
---> c3f583ac3818
Successfully built c3f583ac3818
Successfully tagged getting-started:latest
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.
PS C:\Users\LenovoX\Downloads\app\app> docker run -dp 3000:3000 getting-started
9637c26796f3d2dc1128df885dafb1386defeda26bc7f69cd6d6fbe38d0754c3
PS C:\Users\LenovoX\Downloads\app\app> docker build -t getting-started .
Sending build context to Docker daemon 4.69MB
Step 1/5 : FROM node:12-alpine
---> 18f4bc975732
Step 2/5 : WORKDIR /app
---> Using cache
---> 10872044b09c
Step 3/5 : COPY . .
---> 34b658d040a8
Step 4/5 : RUN yarn install --production
---> Running in cd0f518a7dd0
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...
Removing intermediate container cd0f518a7dd0
---> 6e77a025cf17
Step 5/5 : CMD ["node", "src/index.js"]
Removing intermediate container 15a722b004e0
Successfully built 737e4158a1b6
Successfully tagged getting-started:latest
t permissions for sensitive files and directories.
PS C:\Users\LenovoX\Downloads\app\app> docker run -dp 3000:3000 getting-started
y allocated.
PS C:\Users\LenovoX\Downloads\app\app> docker run -dp 3000:3000 getting-started
0e842a25e00a3353877f3ba6d50dcb16b887acec7d98f958e64c23335c230991
PS C:\Users\LenovoX\Downloads\app\app> docker login -u orsanaw .
Password:
Error response from daemon: Get https://./v2/: dial tcp: lookup .: no such host
PS C:\Users\LenovoX\Downloads\app\app> docker login -u orsanaw
Password:
Login Succeeded
PS C:\Users\LenovoX\Downloads\app\app> docker push orsanaw/simple-task-list
47f92a3033a9: Pushed
02f5ff2722b6: Pushed
2f1a3c8394a7: Pushed
db809908a198: Mounted from library/node
1b235e8e7bda: Mounted from library/node
latest: digest: sha256:a007549c619786e14dd5b85d2cd3b7a96640a6d010dbcc31ab41429b72b41c59 size: 1788
PS C:\Users\LenovoX\Downloads\app\app> docker volume create todo-db
todo-db
Unable to find image 'simple-task-list:latest' locally
See 'docker run --help'.
Password:
PS C:\Users\LenovoX\Downloads\app\app> docker run -dp 3000:3000 -v todo-db:/etc/todos simple-task-list
Unable to find image 'simple-task-list:latest' locally
See 'docker run --help'.
PS C:\Users\LenovoX\Downloads\app\app> docker run -dp 3000:3000 -v todo-db:/etc/todos getting-started
5e33afafc7b596adf69cef0bb8312f80e8cf42a644cc6635d18688257169d64e
PS C:\Users\LenovoX\Downloads\app\app> docker run -dp 3000:3000 -v todo-db:/etc/todos getting-started
07e2bf930f133a50033626f3fb3d1d9034961dd7119c9f87e7ee30dff6d5e4ae
PS C:\Users\LenovoX\Downloads\app\app> docker network create todo-app
26b72f8e2c80abd6ff7015881afd21019433e60c6c4e5761ed37e5463483e9d9
PS C:\Users\LenovoX\Downloads\app\app> docker run -d
docker: invalid reference format.
See 'docker run --help'.
PS C:\Users\LenovoX\Downloads\app\app> --network todo-app --network-alias mysql \

  • --network todo-app --network-alias mysql \
    
  •   ~
    

Missing expression after unary operator '--'.
At line:1 char:7

  • --network todo-app --network-alias mysql \
    
  •   ~~~~~~~
    

Unexpected token 'network' in expression or statement.
+ FullyQualifiedErrorId : MissingExpressionAfterOperator

PS C:\Users\LenovoX\Downloads\app\app> -v todo-mysql-data:/var/lib/mysql
-v : The term '-v' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:5

  • -v todo-mysql-data:/var/lib/mysql \
    
  • ~~
    
    • FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\LenovoX\Downloads\app\app> -e MYSQL_ROOT_PASSWORD=secret
-e : The term '-e' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:5

  • -e MYSQL_ROOT_PASSWORD=secret \
    
  • ~~
    
    • FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\LenovoX\Downloads\app\app> -e MYSQL_DATABASE=todos
-e : The term '-e' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:5

  • -e MYSQL_DATABASE=todos \
    
  • ~~
    
    • CategoryInfo : ObjectNotFound: (-e:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\LenovoX\Downloads\app\app> docker run -d --network todo-app --network-alias mysql -v todo-mysql-data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=secret -e MYSQL_DATABASE=todos mysql:5.7
Unable to find image 'mysql:5.7' locally
5.7: Pulling from library/mysql
d121f8d1c412: Pull complete
f3cebc0b4691: Pull complete
1862755a0b37: Pull complete
690874f836db: Pull complete
baa8be383ffb: Pull complete
277d8f888368: Pull complete
21f2da6feb67: Pull complete
2c98f818bcb9: Pull complete
031b0a770162: Pull complete
Status: Downloaded newer image for mysql:5.7
f29dec0db671c18efd3e86503bacd96b54ca52ec3db6e949da9c483da1add6cb
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
PS C:\Users\LenovoX\Downloads\app\app> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f29dec0db671 mysql:5.7 "docker-entrypoint.s…" 4 minutes ago Up 4 minutes 3306/tcp, 33060/tcp unruffled_morse
07e2bf930f13 getting-started "docker-entrypoint.s…" 13 minutes ago Up 13 minutes 0.0.0.0:3000->3000/tcp boring_mayer
d78104b6cebd docker101tutorial "/docker-entrypoint.…" 4 hours ago Up 4 hours 0.0.0.0:80->80/tcp docker-tutial
PS C:\Users\LenovoX\Downloads\app\app> docker exec -it f29dec0db671 mysql -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
PS C:\Users\LenovoX\Downloads\app\app> docker exec -it f29dec0db671 mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.31 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| sys |
| todos |
+--------------------+
5 rows in set (0.00 sec)

mysql> docker run -it --network todo-app nicolaka/netshoot
->
-> ^C
mysql> EXIT
Bye
PS C:\Users\LenovoX\Downloads\app\app> docker run -it --network todo-app nicolaka/netshoot
Unable to find image 'nicolaka/netshoot:latest' locally
latest: Pulling from nicolaka/netshoot
cbdbe7a5bc2a: Already exists
fa7edde5704a: Pull complete
d142e371ed28: Pull complete
7bc9cb006bce: Pull complete
a4d2c327d444: Pull complete
428e55c983a8: Pull complete
1209022df24d: Pull complete
b74093e72c31: Pull complete
Digest: sha256:04786602e5a9463f40da65aea06fe5a825425c7df53b307daa21f828cfe40bf8
Status: Downloaded newer image for nicolaka/netshoot:latest
dP dP dP
88 88 88
88d888b. .d8888b. d8888P .d8888b. 88d888b. .d8888b. .d8888b. d8888P
88' 88 88ooood8 88 Y8ooooo. 88' 88 88' 88 88' 88 88
88 88 88. ... 88 88 88 88 88. .88 88. .88 88
dP dP 88888P' dP 88888P' dP dP 88888P' 88888P' dP

Welcome to Netshoot! (github.com/nicolaka/netshoot)
root @ /
[1] 🐳 → dig mysql

; <<>> DiG 9.14.12 <<>> mysql
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24678
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;mysql. IN A
;; ANSWER SECTION:
mysql. 600 IN A 172.18.0.2

;; Query time: 165 msec
;; SERVER: 127.0.0.11#53(127.0.0.11)
;; WHEN: Sun Sep 13 13:12:38 UTC 2020
;; MSG SIZE rcvd: 44
docker: invalid reference format.
PS C:\Users\LenovoX\Downloads\app\app> -w /app -v "$(pwd):/app"
PS C:\Users\LenovoX\Downloads\app\app> --network todo-app
PS C:\Users\LenovoX\Downloads\app\app> -e MYSQL_HOST=mysql
-e : The term '-e' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
PS C:\Users\LenovoX\Downloads\app\app> -e MYSQL_PASSWORD=secret
-e : The term '-e' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:3

  • -e MYSQL_DB=todos \
  • ~~
    • CategoryInfo : ObjectNotFound: (-e:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\LenovoX\Downloads\app\app> node:12-alpine
PS C:\Users\LenovoX\Downloads\app\app> sh -c "yarn install && yarn run dev"
sh : The term 'sh' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:3

  • sh -c "yarn install && yarn run dev"
  • ~~
    • CategoryInfo : ObjectNotFound: (sh:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\LenovoX\Downloads\app\app>
PS C:\Users\LenovoX\Downloads\app\app>
PS C:\Users\LenovoX\Downloads\app\app>
PS C:\Users\LenovoX\Downloads\app\app>
PS C:\Users\LenovoX\Downloads\app\app>
PS C:\Users\LenovoX\Downloads\app\app>
PS C:\Users\LenovoX\Downloads\app\app> docker run -dp 3000:3000 -w /app -v "$(pwd):/app" --network todo-app -e MYSQL_HOST=mysql -e MYSQL_USER=root -e MYSQL_PASSWORD=secret -e MYSQL_DB=todos node:12-alpine sh -c "yarn install
&& yarn run dev"
17b0e853a37e26a3a8ea66209bdb76d137a6d3d973f06fcfad742e1731573864
docker: Error response from daemon: driver failed programming external connectivity on endpoint serene_wilbur (bfdc268e28eba09a10e7ea07dd2f4fa744caee77564f9a457d8bc1b7cbe465a6): Bind for 0.0.0.0:3000 failed: port is already allocated.
PS C:\Users\LenovoX\Downloads\app\app> docker run -dp 3000:3000 -w /app -v "$(pwd):/app" --network todo-app -e MYSQL_HOST=mysql -e MYSQL_USER=root -e MYSQL_PASSWORD=secret -e MYSQL_DB=todos node:12-alpine sh -c "yarn install
&& yarn run dev"
cb90e35ebef2b9b58f3ebb7455c7b6eb41859d7cd33e6891a3ff744ed85303b4
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Your MySQL connection id is 7
Server version: 5.7.31 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select * from todo_items;
+--------------------------------------+------------+-----------+
| id | name | completed |
| 09eb8736-1b37-49e0-bd18-f92d895554b4 | buy Milk! | 0 |
| ccff8405-86c5-492c-899e-47b394233e54 | buy Bread! | 0 |
+--------------------------------------+------------+-----------+
2 rows in set (0.00 sec)
mysql> docker-compose version
-> ^C
mysql> ^C
mysql> exit
Bye
PS C:\Users\LenovoX\Downloads\app\app> docker-compose version
docker-py version: 4.2.2
CPython version: 3.7.4
OpenSSL version: OpenSSL 1.1.1c 28 May 2019
PS C:\Users\LenovoX\Downloads\app\app>
PS C:\Users\LenovoX\Downloads\app\app> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cb90e35ebef2 node:12-alpine "docker-entrypoint.s…" 8 minutes ago Up 8 minutes 0.0.0.0:3000->3000/tcp competent_almeida
f29dec0db671 mysql:5.7 "docker-entrypoint.s…" 24 minutes ago Up 24 minutes 3306/tcp, 33060/tcp unruffled_morse
d78104b6cebd docker101tutorial "/docker-entrypoint.…" 4 hours ago Up 4 hours 0.0.0.0:80->80/tcp docker-tutial
PS C:\Users\LenovoX\Downloads\app\app> docker-compose up -d
ERROR:
Can't find a suitable configuration file in this directory or any

    Supported filenames: docker-compose.yml, docker-compose.yaml

PS C:\Users\LenovoX\Downloads\app\app> docker-compose up -d
Creating network "app_default" with the default driver
Creating app_app_1 ...
WARNING: Host is already in use by another container

ERROR: for app_app_1 Cannot start service app: driver failed programming external connectivity on endpoint app_app_1 (5868c601445ddfb694acfdc5b038920439fb8e4b664ab4a2a52ee7dbfb383d6f): Bind for 0.0.0.0:3000 failed: port is aCreating app_mysql_1 ... done
ERROR: for app Cannot start service app: driver failed programming external connectivity on endpoint app_app_1 (5868c601445ddfb694acfdc5b038920439fb8e4b664ab4a2a52ee7dbfb383d6f): Bind for 0.0.0.0:3000 failed: port is alreadyERROR: Encountered errors while bringing up the project.
PS C:\Users\LenovoX\Downloads\app\app> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cb90e35ebef2 node:12-alpine "docker-entrypoint.s…" 11 minutes ago Up 11 minutes 0.0.0.0:3000->3000/tcp competent_almeida
d78104b6cebd docker101tutorial "/docker-entrypoint.…" 4 hours ago Up 4 hours 0.0.0.0:80->80/tcp docker-tutial
PS C:\Users\LenovoX\Downloads\app\app> docker rm -f 612dede4c20d
PS C:\Users\LenovoX\Downloads\app\app> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cb90e35ebef2 node:12-alpine "docker-entrypoint.s…" 11 minutes ago Up 11 minutes 0.0.0.0:3000->3000/tcp competent_almeida
f29dec0db671 mysql:5.7 "docker-entrypoint.s…" 27 minutes ago Up 27 minutes 3306/tcp, 33060/tcp unruffled_morse
PS C:\Users\LenovoX\Downloads\app\app> docker rm -f f29dec0db671
f29dec0db671
PS C:\Users\LenovoX\Downloads\app\app> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
cb90e35ebef2 node:12-alpine "docker-entrypoint.s…" 12 minutes ago Up 12 minutes 0.0.0.0:3000->3000/tcp competent_almeida
d78104b6cebd docker101tutorial "/docker-entrypoint.…" 4 hours ago Up 4 hours 0.0.0.0:80->80/tcp docker-tutial
PS C:\Users\LenovoX\Downloads\app\app> docker rm -f cb90e35ebef2
cb90e35ebef2
PS C:\Users\LenovoX\Downloads\app\app> docker-compose up -d
Starting app_app_1 ... done
Creating app_mysql_1 ... done
PS C:\Users\LenovoX\Downloads\app\app> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
39ce32aa8442 mysql:5.7 "docker-entrypoint.s…" 5 minutes ago Up 5 minutes 3306/tcp, 33060/tcp app_mysql_1
a2199bae223e node:12-alpine "docker-entrypoint.s…" 9 minutes ago Up 5 minutes 0.0.0.0:3000->3000/tcp app_app_1
d78104b6cebd docker101tutorial "/docker-entrypoint.…" 4 hours ago Up 4 hours 0.0.0.0:80->80/tcp docker-tutial
PS C:\Users\LenovoX\Downloads\app\app> docker-compose up
app_mysql_1 is up-to-date
app_app_1 is up-to-date
Attaching to app_mysql_1, app_app_1
mysql_1 | 2020-09-13 13:29:40+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.31-1debian10 started.
mysql_1 | 2020-09-13 13:29:41+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
mysql_1 | 2020-09-13 13:29:41+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.31-1debian10 started.
mysql_1 | 2020-09-13T13:29:41.429235Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
mysql_1 | 2020-09-13T13:29:41.510845Z 0 [Note] mysqld (mysqld 5.7.31) starting as process 1 ...
mysql_1 | 2020-09-13T13:29:41.536670Z 0 [Note] InnoDB: PUNCH HOLE support available
mysql_1 | 2020-09-13T13:29:41.536770Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mysql_1 | 2020-09-13T13:29:41.536782Z 0 [Note] InnoDB: Uses event mutexes
mysql_1 | 2020-09-13T13:29:41.536789Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
mysql_1 | 2020-09-13T13:29:41.536794Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
mysql_1 | 2020-09-13T13:29:41.536800Z 0 [Note] InnoDB: Using Linux native AIO
mysql_1 | 2020-09-13T13:29:41.538354Z 0 [Note] InnoDB: Number of pools: 1
mysql_1 | 2020-09-13T13:29:41.538589Z 0 [Note] InnoDB: Using CPU crc32 instructions
mysql_1 | 2020-09-13T13:29:41.543293Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
mysql_1 | 2020-09-13T13:29:41.555557Z 0 [Note] InnoDB: Completed initialization of buffer pool
mysql_1 | 2020-09-13T13:29:41.559932Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
mysql_1 | 2020-09-13T13:29:41.593050Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
mysql_1 | 2020-09-13T13:29:41.772162Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
mysql_1 | 2020-09-13T13:29:41.772273Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
mysql_1 | 2020-09-13T13:29:42.117510Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
mysql_1 | 2020-09-13T13:29:42.118060Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
mysql_1 | 2020-09-13T13:29:42.118093Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
mysql_1 | 2020-09-13T13:29:42.118816Z 0 [Note] InnoDB: 5.7.31 started; log sequence number 2720976
mysql_1 | 2020-09-13T13:29:42.119447Z 0 [Note] Plugin 'FEDERATED' is disabled.
mysql_1 | 2020-09-13T13:29:42.124676Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
mysql_1 | 2020-09-13T13:29:42.124735Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
mysql_1 | 2020-09-13T13:29:42.125018Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
mysql_1 | 2020-09-13T13:29:42.125219Z 0 [Warning] CA certificate ca.pem is self signed.
mysql_1 | 2020-09-13T13:29:42.125273Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
mysql_1 | 2020-09-13T13:29:42.125838Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
mysql_1 | 2020-09-13T13:29:42.125922Z 0 [Note] IPv6 is available.
mysql_1 | 2020-09-13T13:29:42.125935Z 0 [Note] - '::' resolves to '::';
mysql_1 | 2020-09-13T13:29:42.125971Z 0 [Note] Server socket created on IP: '::'.
mysql_1 | 2020-09-13T13:29:42.127071Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200913 13:29:42
mysql_1 | 2020-09-13T13:29:42.226932Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
mysql_1 | 2020-09-13T13:29:42.258454Z 0 [Note] Event Scheduler: Loaded 0 events
mysql_1 | 2020-09-13T13:29:42.258925Z 0 [Note] mysqld: ready for connections.
mysql_1 | Version: '5.7.31' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
app_1 | yarn install v1.22.4
app_1 | [1/4] Resolving packages...
app_1 | success Already up-to-date.
app_1 | Done in 0.73s.
app_1 | yarn run v1.22.4
app_1 | $ nodemon src/index.js
app_1 | [nodemon] 1.19.2
app_1 | [nodemon] to restart at any time, enter rs
app_1 | [nodemon] watching dir(s): .
app_1 | [nodemon] starting node src/index.js
app_1 | Waiting for mysql:3306.
app_1 | Connected!
app_1 | Error: ER_HOST_NOT_PRIVILEGED: Host '172.19.0.2' is not allowed to connect to this MySQL server
app_1 | at Handshake.Sequence._packetToError (/app/node_modules/mysql/lib/protocol/sequences/Sequence.js:47:14)
app_1 | at Handshake.ErrorPacket (/app/node_modules/mysql/lib/protocol/sequences/Handshake.js:123:18)
app_1 | at Protocol._parsePacket (/app/node_modules/mysql/lib/protocol/Protocol.js:291:23)
app_1 | at Parser._parsePacket (/app/node_modules/mysql/lib/protocol/Parser.js:433:10)
app_1 | at Parser.write (/app/node_modules/mysql/lib/protocol/Parser.js:43:10)
app_1 | at Protocol.write (/app/node_modules/mysql/lib/protocol/Protocol.js:38:16)
app_1 | at Socket. (/app/node_modules/mysql/lib/Connection.js:91:28)
app_1 | at Socket. (/app/node_modules/mysql/lib/Connection.js:525:10)
app_1 | at Socket.emit (events.js:315:20)
app_1 | at addChunk (_stream_readable.js:295:12)
app_1 | --------------------
app_1 | at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:144:48)
app_1 | at Protocol.handshake (/app/node_modules/mysql/lib/protocol/Protocol.js:51:23)
app_1 | at PoolConnection.connect (/app/node_modules/mysql/lib/Connection.js:119:18)
app_1 | at Pool.getConnection (/app/node_modules/mysql/lib/Pool.js:48:16)
app_1 | at Pool.query (/app/node_modules/mysql/lib/Pool.js:202:8)
app_1 | at /app/src/persistence/mysql.js:35:14
app_1 | at new Promise ()
app_1 | at Object.init (/app/src/persistence/mysql.js:34:12)
app_1 | at processTicksAndRejections (internal/process/task_queues.js:97:5) {
app_1 | code: 'ER_HOST_NOT_PRIVILEGED',
app_1 | errno: 1130,
app_1 | sqlMessage: "Host '172.19.0.2' is not allowed to connect to this MySQL server",
app_1 | sqlState: undefined,
app_1 | fatal: true
app_1 | }
app_1 | [nodemon] app crashed - waiting for file changes before starting...
mysql_1 | 2020-09-13T13:41:14.301693Z 0 [Note] Giving 0 client threads a chance to die gracefully
mysql_1 | 2020-09-13T13:41:14.301723Z 0 [Note] Shutting down slave threads
mysql_1 | 2020-09-13T13:41:14.301726Z 0 [Note] Forcefully disconnecting 0 remaining clients
mysql_1 | 2020-09-13T13:41:14.301732Z 0 [Note] Event Scheduler: Purging the queue. 0 events
mysql_1 | 2020-09-13T13:41:14.301787Z 0 [Note] Binlog end
mysql_1 | 2020-09-13T13:41:14.302329Z 0 [Note] Shutting down plugin 'ngram'
mysql_1 | 2020-09-13T13:41:14.302338Z 0 [Note] Shutting down plugin 'partition'
mysql_1 | 2020-09-13T13:41:14.302341Z 0 [Note] Shutting down plugin 'BLACKHOLE'
mysql_1 | 2020-09-13T13:41:14.302344Z 0 [Note] Shutting down plugin 'ARCHIVE'
mysql_1 | 2020-09-13T13:41:14.302346Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
mysql_1 | 2020-09-13T13:41:14.302368Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
mysql_1 | 2020-09-13T13:41:14.302371Z 0 [Note] Shutting down plugin 'MyISAM'
mysql_1 | 2020-09-13T13:41:14.302379Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
mysql_1 | 2020-09-13T13:41:14.302382Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
mysql_1 | 2020-09-13T13:41:14.302384Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
mysql_1 | 2020-09-13T13:41:14.302385Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
mysql_1 | 2020-09-13T13:41:14.302387Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
mysql_1 | 2020-09-13T13:41:14.302389Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
mysql_1 | 2020-09-13T13:41:14.302391Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
mysql_1 | 2020-09-13T13:41:14.302393Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
mysql_1 | 2020-09-13T13:41:14.302395Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
mysql_1 | 2020-09-13T13:41:14.302397Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
mysql_1 | 2020-09-13T13:41:14.302398Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
mysql_1 | 2020-09-13T13:41:14.302400Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
mysql_1 | 2020-09-13T13:41:14.302402Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
mysql_1 | 2020-09-13T13:41:14.302404Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
mysql_1 | 2020-09-13T13:41:14.302406Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
mysql_1 | 2020-09-13T13:41:14.302407Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
mysql_1 | 2020-09-13T13:41:14.302409Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
mysql_1 | 2020-09-13T13:41:14.302411Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
mysql_1 | 2020-09-13T13:41:14.302413Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
mysql_1 | 2020-09-13T13:41:14.302415Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
mysql_1 | 2020-09-13T13:41:14.302417Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
mysql_1 | 2020-09-13T13:41:14.302418Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
mysql_1 | 2020-09-13T13:41:14.302420Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
mysql_1 | 2020-09-13T13:41:14.302422Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
mysql_1 | 2020-09-13T13:41:14.302424Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
mysql_1 | 2020-09-13T13:41:14.302426Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
mysql_1 | 2020-09-13T13:41:14.302428Z 0 [Note] Shutting down plugin 'INNODB_CMP'
mysql_1 | 2020-09-13T13:41:14.302430Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
mysql_1 | 2020-09-13T13:41:14.302431Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
mysql_1 | 2020-09-13T13:41:14.302435Z 0 [Note] Shutting down plugin 'InnoDB'
mysql_1 | 2020-09-13T13:41:14.302487Z 0 [Note] InnoDB: FTS optimize thread exiting.
mysql_1 | 2020-09-13T13:41:14.402995Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
mysql_1 | 2020-09-13T13:41:14.403476Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 200913 13:41:14
mysql_1 | 2020-09-13T13:41:15.944238Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
mysql_1 | 2020-09-13T13:41:15.944423Z 0 [Note] Shutting down plugin 'MEMORY'
mysql_1 | 2020-09-13T13:41:15.944449Z 0 [Note] Shutting down plugin 'CSV'
mysql_1 | 2020-09-13T13:41:15.944463Z 0 [Note] Shutting down plugin 'sha256_password'
mysql_1 | 2020-09-13T13:41:15.944471Z 0 [Note] Shutting down plugin 'mysql_native_password'
mysql_1 | 2020-09-13T13:41:15.944920Z 0 [Note] Shutting down plugin 'binlog'
mysql_1 | 2020-09-13T13:41:15.946456Z 0 [Note] mysqld: Shutdown complete
mysql_1 |
app_app_1 exited with code 1
app_mysql_1 exited with code 0
PS C:\Users\LenovoX\Downloads\app\app> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d78104b6cebd docker101tutorial "/docker-entrypoint.…" 4 hours ago Up 4 hours 0.0.0.0:80->80/tcp docker-tutial
PS C:\Users\LenovoX\Downloads\app\app> docker-compose up -d
app_app_1 is up-to-date
app_mysql_1 is up-to-date
PS C:\Users\LenovoX\Downloads\app\app> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
39ce32aa8442 mysql:5.7 "docker-entrypoint.s…" 40 minutes ago Up 28 minutes 3306/tcp, 33060/tcp app_mysql_1
a2199bae223e node:12-alpine "docker-entrypoint.s…" 43 minutes ago Up 28 minutes 0.0.0.0:3000->3000/tcp app_app_1
d78104b6cebd docker101tutorial "/docker-entrypoint.…" 5 hours ago Up 5 hours 0.0.0.0:80->80/tcp docker-tutial
PS C:\Users\LenovoX\Downloads\app\app>

Failed to Run the Example in `Persisting our DB`

I followed the tutorial to install and run docker/getting-started container.

And I ran into an issue:

$ sudo docker run -d ubuntu -c "shuf -i 1-10000 -n 1 -o /data.txt && tail -f /dev/null"
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
d72e567cc804: Pull complete 
0f3630e5ff08: Pull complete 
b6a83d81d1f4: Pull complete 
Digest: sha256:bc2f7250f69267c9c6b66d7b6a81a54d3878bb85f1ebb5f951c896d13e6ba537
Status: Downloaded newer image for ubuntu:latest
84ea529f74a5824fd3a5d21a6deb01f97d291eb26c95a21883ddccb85ee2b129
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"-c\": executable file not found in $PATH": unknown.

I was following this chapter http://localhost/tutorial/persisting-our-data

Seems like exec is missing the ubuntu's image?

Add instructions such as Ps command with filter

I recommend to add the instructions to the docker ps -f.

I have coppied many times the ids of the containers, and it keep us distant to the principles of programming.

do it once do it right.

It is much better to have a notation like:

docker stop $(docker ps -qf "ancestor=mysql:5.7")
docker exec -it $(docker ps -qf "ancestor=mysql:5.7") mysql -p

and so on.

This may lead to a more fluid learning pace.

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.