Friday 24 November 2017

Common & frequent errors in docker setup

Environment: Windows 7, 8.(While using Docker Toolbox)

Action: Running command:- docker run hello-world

Error Message : Unable to find image 'hello-world:latest' locally Pulling repository docker.io/library/hello-world

Solution: Add below code to "C:\Program Files\Docker Toolbox\start.sh" at the end of file.

HTTP_PROXY=http://$proxy_user:$proxy_pass@$ip_server_proxy:$port

-----------------------------------------------------------------------------------------------------------------------

Environment: Windows 7, 8.(While using Docker Toolbox)

Action : Running angular based dockerfile which has npm install

Error Message: npm returned non-zero exit code

Solution: Increase your Ram size in your vagrant VM.


------------------------------------------------------------------------------------------------------------------------
Environment: Windows 7, 8.(While using Docker Toolbox)

Action : Docker-Compose throws below error.


Solution: Check the indentation and tab spacing, roughly the indention should proper key value pair as below.

------------------------------------------------------------------------------------------------------------------------
Environment: Windows 7, 8.(While using Docker Toolbox)

Action : Docker run throws below error when the angular-cli created angular app when run does not show the app in the browser.

Error Message: Invalid Host header

Solution: Change the package.json in your angular 2 app with the below value.






Environment: Windows 10

Action : Docker run throws error when running  "docker run"

Error Message "A firewall is blocking file Sharing between Windows and the containers. See documentation for more info."

Solution: Run the below script in powershell.

Set-NetConnectionProfile -interfacealias "vEthernet (DockerNAT)" -NetworkCategory Private
:

How to run Multiple container using docker compose

If you have not cloned or downloaded the git repo, please run the command below.


  1. Stop all containers:

docker stop $(docker ps -a -q)

  1. Navigate to the folder where you have downloaded/cloned the sample.



  1. Create a file named as “docker-compose.yml”.

  1. Add content as shown below.

  1. Run below command to build docker compose

docker-compose up -d --build --remove-orphans

  1. Run below command to run docker compose.

docker-compose up

In case if you get access denied error please share the drive you have your dockerfiles running.

  1. For windows 10: Navigate to http://localhost:9001



  1. For windows 7,8: Navigate to http://192.168.99.100:9001/



  1. For windows 10: Navigate to http://localhost:8080


  1. For windows 7,8: Navigate to http://192.168.99.100:8080/










How to run an angular app in docker

If you have not cloned or downloaded the git repo, please run the command below.


  1. Navigate to Folder using command prompt or docker prompt(windows 7,8 user) where you copied the  nodelinuximage.tgz

  1. Run below command to load the image to your system.

docker load < nodelinuximage.tgz

  1. Navigate to the angularclient folder.

  1. Create a file named as “DockerFile” without any extension inside the angularclient .

  1. Add content as shown below.


  1. Open command prompt or docker command prompt(windows 7,8 user)

  1. Navigate to the folder in the (docker)command prompt where the dockerfile was created.

  1. Run below command:

docker build -t angularclient .

docker run -it --rm -p 9001:4200 -v ${pwd}/src:/app/src angularclient

  1. For windows 10: Navigate to http://localhost:9001



  1. For windows 7,8: Navigate to http://192.168.99.100:9001/



  1. Stop all containers:

docker stop $(docker ps -a -q)

How to run a .Net core app using docker

For Windows 10 User(see below for windows 7,8 user):

  1. Click on Docker for windows and start docker.

  1. Navigate to Docker on your tray and click “Switch to linux container”

  1. Open command prompt: Type “docker run hello-world”. You  should get below message.



For Windows 7,8 user

  1. Click on and start the docker

  1. On the docker prompt: Type “docker run hello-world”. You  should get below message.

  1. Navigate to Folder using command prompt or docker command prompt(windows 7,8 user) where you copied the  linuxcoreimage.tgz and aspnetcoreimage.tgz

  1. Run below command to load the image to your system.

docker load < linuxcoreimage.tgz
docker load < aspnetcoreimage.tgz

  1. Download the .Net core/Angular project  project from the github(Make sure git is installed)


  1. Create a file named as “DockerFile” without any extension inside the aspnetapp.

  1. Add content as shown below


  1. Open command prompt or docker command prompt(windows 7,8 user)

  1. Navigate to the folder in the (docker)command prompt where the dockerfile was created

docker build -t netcorewebapi .
docker run -t -p 8080:80 netcorewebapi:latest

  1. For windows 10: Navigate to http://localhost:8080


  1. For windows 7,8: Navigate to http://192.168.99.100:8080/


Build Bot using LUIS