Completek8s Classroomnotes 11/Jul/2023

Communication between applications in Docker

  • Lets establish container connectivity for the nopCommerce
    Preview
  • Lets quickly write a dockerfile for nopcommerce
FROM alpine:3.18.2 AS extractor
ARG DOWNLOAD_URL="https://github.com/nopSolutions/nopCommerce/releases/download/release-4.60.3/nopCommerce_4.60.3_NoSource_linux_x64.zip"
ARG TARGET_FOLDER="/nop"
ADD ${DOWNLOAD_URL} ${TARGET_FOLDER}/nopCommerce_4.60.3_NoSource_linux_x64.zip
RUN apk update && \
    apk add unzip && \
    cd ${TARGET_FOLDER} && \
    unzip nopCommerce_4.60.3_NoSource_linux_x64.zip \
    && rm nopCommerce_4.60.3_NoSource_linux_x64.zip && \
    mkdir bin logs


FROM mcr.microsoft.com/dotnet/sdk:7.0
LABEL author=khajaibrahim
ARG TARGET_FOLDER="/nop"
ENV ASPNETCORE_URLS="http://0.0.0.0:5000"
COPY --from=extractor ${TARGET_FOLDER}  ${TARGET_FOLDER}
EXPOSE 5000
WORKDIR ${TARGET_FOLDER}
CMD ["dotnet", "Nop.Web.dll"]
  • Create a docker image with name nop:4.60.3
  • Lets create a bridge network with cidr range 192.168.0.0/24
    Preview
  • Lets create a mysql container with on nop-net network
    • username => nop
    • pwd => nop@123
    • root password => nop@123
    • database name => nopdb
docker container run --name nopdb -d -e MYSQL_ROOT_PASSWORD=nop@123 -e MYSQL_DATABASE=nopdb -e MYSQL_USER=nop -e MYSQL_PASSWORD=nop@123 --network nop-net mysql:8
  • Lets inspect ip address for this container
docker network inspect nop-net

Preview
* note: when you practice ensure you create and mount volume
* Lets try creating nop container in the same network

docker container run -d --name nop1 --network nop-net -p 32000:5000 nop:4.60.3
  • Lets inspect network again
    Preview
  • Now lets configure the application by accessing it
    Preview
  • Now enter the data base details
    Preview
  • Once the installation is complete the nop container will be stopped, kindly start it
  • Now access the application
    Preview
  • Exercise:

    • Create a multistage build for nopCommerce
    • Try it with mysql db and postgres db
    • Optional try with sql server sudo docker pull mcr.microsoft.com/mssql/server:2022-latest

Docker compose

  • Lets try running nop commerce in a system in easier way
  • consider the nopCommerce code from here Refer Here
  • Refer Here for the yaml file created
  • Clone the git repo and cd into it
  • Then execute
git checkout compose_intro
docker compose up -d

Preview
Preview

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Integration by Acurax Wordpress Developers

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube