Useful docker examples

Create image with new react template app

  • Get image from docker repository
  • Update all packages and install useful libs
  • Create new react project and setup port as environment variable

FROM alpine:latest
RUN apk update && apk add vim && apk add curl && apk add git && apk add npm
RUN mkdir /home/app
WORKDIR /home/app
RUN npx create-react-app my_app
WORKDIR /home/app/my_app
VOLUME /home/app/my_app
ENV PORT=4200

Create and setup mongo – express tool

  • Pull images from docker repository for mongo and mongo-express
  • Create new network connection
  • Run new mongo container
  • Run new mongo-express container

docker pull mongo

docker pull mongo-express

docker network create mongo-network

docker run --name mongodb -p 27017:27017 -d
-e MONGO_INITDB_ROOT_PASSWORD=password
-e MONGO_INITDB_ROOT_USERNAME=admin
--net mongo-network
mongo

docker run --name mongo-express -p 8081:8081 -d
-e ME_CONFIG_MONGODB_ADMINUSERNAME=admin
-e ME_CONFIG_MONGODB_ADMINPASSWORD=password
--net mongo-network
-e ME_CONFIG_MONGODB_SERVER=mongodb
mongo-express

Create and setup NetCloud

docker run -d \ -v nextcloud:/var/www/html \ -v apps:/var/www/html/custom_apps \ -v config:/var/www/html/config \ -v data:/var/www/html/data \ -v theme:/var/www/html/themes/<YOUR_CUSTOM_THEME> \ nextcloud

Popular Posts
Categories
Archives
Tags

There’s no content to show here yet.

Translate »