Skip to main content
Fix some Markdown formatting for rendering code snippets
Source Link

Quoting from the Official Website:

  1. Make sure you don’t have any previous getting-started containers running.

  2. Run the following command from the app directory.

  • x86-64 Mac or Linux device:

    docker run -dp 3000:3000 \

    -w /app -v "$(pwd):/app" \

    node:12-alpine \

    sh -c "yarn install && yarn run dev"

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

    docker run -dp 3000:3000 `

    -w /app -v "$(pwd):/app" `

    node:12-alpine `

    sh -c "yarn install && yarn run dev"

    docker run -dp 3000:3000 \
      -w /app -v "$(pwd):/app" \
      node:12-alpine \
      sh -c "yarn install && yarn run dev"
    
  • Aple silicon Mac or another ARM64 device:

    docker run -dp 3000:3000 \

    -w /app -v "$(pwd):/app" \

    node:12-alpine \

    sh -c "apk add --no-cache python2 g++ make && yarn install && yarn run dev"

    docker run -dp 3000:3000 \\
      -w /app -v "$(pwd):/app" \\
      node:12-alpine \\
      sh -c "apk add --no-cache python2 g++ make && yarn install && yarn run dev"
    

Explaining:

  • dp 3000:3000dp 3000:3000 - same as before. Run in detached (background) mode and create a port mapping
  • w /appw /app - sets the “working directory” or the current directory that the command will run from
  • v "$(pwd):/app"v "$(pwd):/app" - bind mount the current directory from the host into the /app directory in the container
  • node:12-alpinenode:12-alpine - the image to use.

Note that this is the base image for our app from the Dockerfile sh -c "yarn install && yarn run dev"Dockerfile sh -c "yarn install && yarn run dev" - the command.

We’re starting a shell using shsh (alpine doesn’t have bashBash) and running yarn installyarn install to install all dependencies and then running yarn run devrun dev. If we look in the package.jsonpackage.json, we’ll see that the dev script is starting nodemonnodemon.

Quoting from the Official Website:

  1. Make sure you don’t have any previous getting-started containers running.

  2. Run the following command from the app directory.

  • x86-64 Mac or Linux device:

    docker run -dp 3000:3000 \

    -w /app -v "$(pwd):/app" \

    node:12-alpine \

    sh -c "yarn install && yarn run dev"

  • Windows (PowerShell):

    docker run -dp 3000:3000 `

    -w /app -v "$(pwd):/app" `

    node:12-alpine `

    sh -c "yarn install && yarn run dev"

  • Aple silicon Mac or another ARM64 device:

    docker run -dp 3000:3000 \

    -w /app -v "$(pwd):/app" \

    node:12-alpine \

    sh -c "apk add --no-cache python2 g++ make && yarn install && yarn run dev"

Explaining:

  • dp 3000:3000 - same as before. Run in detached (background) mode and create a port mapping
  • w /app - sets the “working directory” or the current directory that the command will run from
  • v "$(pwd):/app" - bind mount the current directory from the host into the /app directory in the container
  • node:12-alpine - the image to use.

Note that this is the base image for our app from the Dockerfile sh -c "yarn install && yarn run dev" - the command.

We’re starting a shell using sh (alpine doesn’t have bash) and running yarn install to install all dependencies and then running yarn run dev. If we look in the package.json, we’ll see that the dev script is starting nodemon.

Quoting from the Official Website:

  1. Make sure you don’t have any previous getting-started containers running.

  2. Run the following command from the app directory.

  • x86-64 Mac or Linux device:

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

    docker run -dp 3000:3000 \
      -w /app -v "$(pwd):/app" \
      node:12-alpine \
      sh -c "yarn install && yarn run dev"
    
  • Aple silicon Mac or another ARM64 device:

    docker run -dp 3000:3000 \\
      -w /app -v "$(pwd):/app" \\
      node:12-alpine \\
      sh -c "apk add --no-cache python2 g++ make && yarn install && yarn run dev"
    

Explaining:

  • dp 3000:3000 - same as before. Run in detached (background) mode and create a port mapping
  • w /app - sets the “working directory” or the current directory that the command will run from
  • v "$(pwd):/app" - bind mount the current directory from the host into the /app directory in the container
  • node:12-alpine - the image to use.

Note that this is the base image for our app from the Dockerfile sh -c "yarn install && yarn run dev" - the command.

We’re starting a shell using sh (alpine doesn’t have Bash) and running yarn install to install all dependencies and then running yarn run dev. If we look in the package.json, we’ll see that the dev script is starting nodemon.

Source Link
Dimitri Hartt
  • 1.9k
  • 16
  • 17

Quoting from the Official Website:

  1. Make sure you don’t have any previous getting-started containers running.

  2. Run the following command from the app directory.

  • x86-64 Mac or Linux device:

    docker run -dp 3000:3000 \

    -w /app -v "$(pwd):/app" \

    node:12-alpine \

    sh -c "yarn install && yarn run dev"

  • Windows (PowerShell):

    docker run -dp 3000:3000 `

    -w /app -v "$(pwd):/app" `

    node:12-alpine `

    sh -c "yarn install && yarn run dev"

  • Aple silicon Mac or another ARM64 device:

    docker run -dp 3000:3000 \

    -w /app -v "$(pwd):/app" \

    node:12-alpine \

    sh -c "apk add --no-cache python2 g++ make && yarn install && yarn run dev"

Explaining:

  • dp 3000:3000 - same as before. Run in detached (background) mode and create a port mapping
  • w /app - sets the “working directory” or the current directory that the command will run from
  • v "$(pwd):/app" - bind mount the current directory from the host into the /app directory in the container
  • node:12-alpine - the image to use.

Note that this is the base image for our app from the Dockerfile sh -c "yarn install && yarn run dev" - the command.

We’re starting a shell using sh (alpine doesn’t have bash) and running yarn install to install all dependencies and then running yarn run dev. If we look in the package.json, we’ll see that the dev script is starting nodemon.