Update screenshots and docs to latest versions
Signed-off-by: Michael Irwin <mikesir87@gmail.com>
This commit is contained in:
Binary file not shown.
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 280 KiB |
@@ -46,7 +46,7 @@ For now, we will create the network first and attach the MySQL container at star
|
||||
-v todo-mysql-data:/var/lib/mysql \
|
||||
-e MYSQL_ROOT_PASSWORD=secret \
|
||||
-e MYSQL_DATABASE=todos \
|
||||
mysql:5.7
|
||||
mysql:8.0
|
||||
```
|
||||
|
||||
If you are using PowerShell then use this command.
|
||||
@@ -57,7 +57,7 @@ For now, we will create the network first and attach the MySQL container at star
|
||||
-v todo-mysql-data:/var/lib/mysql `
|
||||
-e MYSQL_ROOT_PASSWORD=secret `
|
||||
-e MYSQL_DATABASE=todos `
|
||||
mysql:5.7
|
||||
mysql:8.0
|
||||
```
|
||||
|
||||
You'll also see we specified the `--network-alias` flag. We'll come back to that in just a moment.
|
||||
@@ -67,20 +67,6 @@ For now, we will create the network first and attach the MySQL container at star
|
||||
where MySQL stores its data. However, we never ran a `docker volume create` command. Docker recognizes we want
|
||||
to use a named volume and creates one automatically for us.
|
||||
|
||||
!!! info "Troubleshooting"
|
||||
If you see a `docker: no matching manifest` error, it's because you're trying to run the container in a different
|
||||
architecture than amd64, which is the only supported architecture for the mysql image at the moment. To solve this
|
||||
add the flag `--platform linux/amd64` in the previous command. So your new command should look like this:
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
--network todo-app --network-alias mysql --platform linux/amd64 \
|
||||
-v todo-mysql-data:/var/lib/mysql \
|
||||
-e MYSQL_ROOT_PASSWORD=secret \
|
||||
-e MYSQL_DATABASE=todos \
|
||||
mysql:5.7
|
||||
```
|
||||
|
||||
1. To confirm we have the database up and running, connect to the database and verify it connects.
|
||||
|
||||
```bash
|
||||
@@ -139,7 +125,7 @@ which ships with a _lot_ of tools that are useful for troubleshooting or debuggi
|
||||
And you'll get an output like this...
|
||||
|
||||
```text
|
||||
; <<>> DiG 9.14.1 <<>> mysql
|
||||
; <<>> DiG 9.18.8 <<>> mysql
|
||||
;; global options: +cmd
|
||||
;; Got answer:
|
||||
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32162
|
||||
@@ -177,7 +163,7 @@ The todo app supports the setting of a few environment variables to specify MySQ
|
||||
|
||||
!!! warning Setting Connection Settings via Env Vars
|
||||
While using env vars to set connection settings is generally ok for development, it is **HIGHLY DISCOURAGED**
|
||||
when running applications in production. Diogo Monica, the former lead of security at Docker,
|
||||
when running applications in production. Diogo Monica, a former lead of security at Docker,
|
||||
[wrote a fantastic blog post](https://diogomonica.com/2017/03/27/why-you-shouldnt-use-env-variables-for-secret-data/)
|
||||
explaining why.
|
||||
|
||||
@@ -202,24 +188,10 @@ With all of that explained, let's start our dev-ready container!
|
||||
-e MYSQL_USER=root \
|
||||
-e MYSQL_PASSWORD=secret \
|
||||
-e MYSQL_DB=todos \
|
||||
node:12-alpine \
|
||||
node:18-alpine \
|
||||
sh -c "yarn install && yarn run dev"
|
||||
```
|
||||
|
||||
If you updated your docker file in the Bind Mount section of the tutorial use the updated command:
|
||||
|
||||
```bash hl_lines="3 4 5 6 7"
|
||||
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 "apk --no-cache --virtual build-dependencies add python2 make g++ && yarn install && yarn run dev"
|
||||
```
|
||||
|
||||
If you are using PowerShell then use this command.
|
||||
|
||||
```powershell hl_lines="3 4 5 6 7"
|
||||
@@ -230,7 +202,7 @@ With all of that explained, let's start our dev-ready container!
|
||||
-e MYSQL_USER=root `
|
||||
-e MYSQL_PASSWORD=secret `
|
||||
-e MYSQL_DB=todos `
|
||||
node:12-alpine `
|
||||
node:18-alpine `
|
||||
sh -c "yarn install && yarn run dev"
|
||||
```
|
||||
|
||||
@@ -240,9 +212,10 @@ With all of that explained, let's start our dev-ready container!
|
||||
```plaintext hl_lines="7"
|
||||
# Previous log messages omitted
|
||||
$ nodemon src/index.js
|
||||
[nodemon] 1.19.2
|
||||
[nodemon] 2.0.20
|
||||
[nodemon] to restart at any time, enter `rs`
|
||||
[nodemon] watching dir(s): *.*
|
||||
[nodemon] watching path(s): *.*
|
||||
[nodemon] watching extensions: js,mjs,json
|
||||
[nodemon] starting `node src/index.js`
|
||||
Connected to mysql db at host mysql
|
||||
Listening on port 3000
|
||||
|
Reference in New Issue
Block a user