Solved: docker – error during connect

sagu@sagu-pc MINGW64 ~

$ docker image ls

error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.29/images/json: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.

sagu@sagu-pc MINGW64 ~

If you are getting above error while running the docker commands in Docker Quickstart Terminal then you can have one of the listed problem.

  • The docker deamon is not running.
  • The docker host machine itself is down.
  • Required configuration file is missing.

First check that the host machine is up and the configuration file is present at its location. Once you are sure both the above things are ok, in that case easiest way to get rid of this issue is to open the Docker Quickstart Terminal by selecting “Run as Administrator” .  It will take some time to start but let it complete and you should be back in business soon.

Solved: How to copy paste in Docker Quickstart Terminal

If you want to copy/paste the contents on Docker Quickstart Terminal using mouse follow these steps.

  • Open the Docker Quickstart Terminal as an Administrator.
  • At the top of terminal right Click on the Blue Whale icon and select “Defaults”.
  • In the “Options” tab of new window check the QuickEdit Mode(refer image below) and click OK.

t

  • Now with mouse left click you can select the content and paste with right click.

Solved: How to cap or limit memory usage of a docker container

In this post we will see how we can cap or restrict the maximum amount of memory the container can use.

Let’s first see the current usage of container id ec6ed4af7c34 with “docker stats”.

docker stats ec6ed4af7c34

In the below image we can see the current limit of the container is 300MiB

Now let’s change this limit to 200MiB of a running container.

docker container update -m 200m ec6ed4af7c34

Now when we look at “docker stats” we can see in the image below the new limit on the container.

If you want to set the memory limit at the time of launching the container itself do it as

docker run -exec -it -m 200m image-name /bin/bash

Compose file version 3

If you want to restrict the usage from the compose file itself you can follow below example, the redis service is constrained to use no more than 50M of memory and 0.50 (50%) of available processing time (CPU), and has 20M of memory and 0.25 CPU time reserved (as always available to it).

version: '3'
services:
 redis:
 image: redis:alpine
 deploy:
 resources:
 limits:
 cpus: '0.50'
 memory: 50M
 reservations:
 cpus: '0.25'
 memory: 20M

Hope this post is helpful to you. Do let me know if you have any query.

Solved: Error when allocating new name – Docker

Error response from daemon: Error when allocating new name: Conflict. The container name "/webserver" is already in use by container 6c34a8wetwyetwy7463462d329c9601812tywetdyud76767d65f7dc7ea58d8541. You have to remove (or rename) that container to be able to reuse that name.

If you see the above error it is because a container with same name exist.

Let’s check our running containers

Continue reading “Solved: Error when allocating new name – Docker”

How to load database in mysql docker container?

After creating the mysql docker container i wanted to load a new database dump to it.

In case you are wondering how to create dockers on you windows machine you can refer my post here .

If you are just testing it you can download a sample mysql database from here .

Once you have downloaded the sample DB unzip it in a folder.

 

First, copy the database into the container:
$ docker cp mydump.sql c598nvcvc190:/root  # Here c598nvcvc190 is name of database container

How to use WordPress in Docker Container on your Windows Laptop.

Pre-requisites:-

I am using “Docker for Windows” software to run dockers on my Windows 10 laptop. You can get “Docker for Windows” by clicking on this link .

If you have Windows 7 download Docker Toolbox for Windows with Virtualbox.

Once you’ve installed Docker Toolbox, install a VM with Docker Machine using the VirtualBox provider:

docker-machine create --driver=virtualbox default
docker-machine ls
eval "$(docker-machine env default)"
How to create docker containers?

Once you have installed pre-requisite software create a docker-compose.yml file in a text editor.

Continue reading “How to use WordPress in Docker Container on your Windows Laptop.”