Docker on Windows Server 2016 TP4 Downloading git in container through powershell - windows

I have an angular UI and a nodejs api. I am currently running windows server 2016 TP4 in Azure.Here are the steps I go through:
I am able to remote in, create images, create containers based off those images, and attach to those containers no problem.
I pulled a nodejs image from docker: docker pull microsoft/node and then created a container from that image: docker run --name 'my_api_name' -it microsoft/node cmd
That command takes me into the container via a windows command prompt. I type powershell which takes me into a powershell shell and i can run npm commands.
My question is, how do I install git onto this container? I want to reach out to the repository holding my app, pull it down and run it in this container. I will eventually push this container image up to the docker registry so clients can pull it down and run it on their windows env.

You can do it like this in admin shell:
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
cinst -y git

Ideally you wouldn't add git to the container and try to pull your repo into it (that will also get messy with credentials for private repos
You should do your source control management on your host and then build the source code into a container. It's not yet there for the Windows Dockerfiles, but the Linux ones have ONBUILD. It should be possible to replicate that for Windows.

RUN #powershell iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
RUN cinst -y git
Refer: Unable to install git and python packages inside Windows container

Solved this by downloading the "Portable" version of Git. Copying those files into the container and ***then running the post installation script provided by Git.
Find appropriate download here: https://git-scm.com/download/win
Inside docker file:
ADD Git64/ C:/Git/
WORKDIR C:/Git/
RUN %windir%\System32\cmd.exe "/K" C:\Git\post-install.bat

Related

Why is conda not initiating shell?

I've downloaded docker on windows and tried to download a remote docker file using the code bellow.
docker build -t bio https://raw.githubusercontent.com/PacktPublishing/Bioinformatics-with-Python-Cookbook-third-edition/main/docker/Chapter01/Dockerfile
However, whether I run this command in the docker shell, CMD, or PowerShell. I encounter the same issue.
How can I resolve this?

Docker-Compose not installed with Docker Desktop

I installed Docker Desktop v4.12.0 on windows 10 which installed docker v20.10.17.
I am trying to run docker-compose pull but get the response docker: 'compose' is not a docker command. I've tried reinstalling Docker Desktop but I still get the same error.
docker-compose --version and docker compose --version both return the same error message.
I'm new to docker and not sure if I've done something incorrectly. Any help would be greatly appreciated!
This can happen when we have older files laying around in windows path.
Try this in Linux:
where docker
where docker-compose
Or in Windows Powershell,
Get-Command docker
Get-Command docker-compose
If you have multiple paths, maybe one of them is very old.
In my case, I had to delete docker.exe and dockerd.exe in the root of c:\Program Files\Docker. The new files should be in the resources\bin folder.

Docker setup on WSL for a Laravel website

I have entered into the WSL terminal the following command:
docker compose build --no-cache && docker compose up
This is what happened:
I have not downloaded anything outside of Docker on this computer and I have cloned this "backend" from the repository.
I have no experience in Docker or Laravel.
What methods should I start with to fix this?
The option -g in the groupadd command needs to be numerical, you can't use use the word sail.
See Ubuntu's documentation about that command and option here.

issue while installing docker for Mac using command line?

I want to install docker using command line not using docker for mac. I have downloaded the individual binary for Mac from this link.
docker ce binaries
I am able to run docker command but if I run docker ps then it shows
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?.
I tried another way to downloading docker using brew as below
brew cask install docker
But using brew it only download the desktop setup of docker and I have to start it manually.
So I am looking for a solution in which I can install and run docker through command without involving any UI.
Thanks
The error above means that the docker service is not running so you have to run it first. Then enable it to start on boot - to avoid the need to start it each time you login to your macOS - at the end you should be able to use docker cli without issues

How to download Docker CLI only for Windows 7

I'm using Windows 7 Pro and have existing shared Docker engine running on a Linux. I would like to use my workstation (with development environment) to access shared Docker engine.
Does someone know how to retrieve Docker client only for Windows 7 ? I have no admin privilege, so I can't install Docker Toolbox.
Older Clients can be found here https://download.docker.com/win/static/stable/x86_64/
And here a some newer Builds by Stefan Scherer (Docker employee) https://github.com/StefanScherer/docker-cli-builder.
Just download docker.exe and add it to your windows path variable.
Then set your DOCKER_HOST variable to define against which Docker daemon you want to speak.
The official Downloads have finally been published:
Mac CLI binaries are available at
https://download.docker.com/mac/static/stable/
Windows CLI (and daemon) binaries at https://download.docker.com/win/
Linux CLI packages are available for each distro as docker-cli (deb and rpm) packages: https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/
From: https://github.com/docker/cli/issues/2281#issuecomment-947699400
Although docker provides a REST-like API, there aren't many clients for it. A quick google turned up one on github, but ymmv. Even if you did find one, you're likely to run into the same problems involved in running docker-ce locally anyway.
There are a handful of gui clients that you could run on that engine and access with a browser, but if you are specifically after a cli you're SOL with this.
If you have an ssh client (git bash, or putty, or something), and you can arrange to run a bastion container on the engine, then you could run a container to ssh into and use that as if it's your local machine. You'd still have to scp resources onto it, but you'll eventually have to solve that problem anyway. Something like:
sudo docker container run --interactive --tty -v /var/run/docker.sock:/var/run/docker.sock image
Where 'image' is a linux image with an ssh server and appropriate keys, git, and docker installed. You could mount a local volume for persistence, or you could just keep everything in git.

Resources