Powershell List Process in Docker Windows Container Produces Empty List - windows

I need to get the process id of a dotnet application running in a windows container in order to attach a debugger to it, but when I try to list the processess, I get an empty list.
PS > docker exec -it --privileged elated_swartz powershell -Command Get-CimInstance Win32_Process | Select-Object ProcessId, CommandLine
ProcessId CommandLine
--------- -----------
PSVersion 5.1.15063.483
Docker Client:
Version: 17.06.0-ce
API version: 1.30
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:30:30 2017
OS/Arch: windows/amd64
Docker Server:
Version: 17.06.0-ce
API version: 1.30 (minimum version 1.24)
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 22:19:00 2017
OS/Arch: windows/amd64
Experimental: true

In *nix:
docker top <container>
In Windows
Using CMD:
docker exec <container> tasklist
Using Powershell:
docker exec <container> powershell get-process

Related

MacOS Docker Container runs out of space although host has enough space

The problem
In a docker container i want to download some packages with nuget. These packages size is around 5 GB. After downloading them they will be unpackaged in a mounted folder, for later use.
When doing this nuget returns an error saying "disk full", although there is several 100GB of space left on the host.
Doing the same thing on windows and linux works fine.
The container is not started with docker run, but with docker compose run.
What I've tried
docker system prune -a
Restart docker
Increase the memory in the docker preferences to 8GB
Increase the SWAP size to the maximum (4GB is the max)
My current docker settings
Docker version
Client:
Cloud integration: v1.0.22
Version: 20.10.12
API version: 1.41
Go version: go1.16.12
Git commit: e91ed57
Built: Mon Dec 13 11:46:56 2021
OS/Arch: darwin/amd64
Context: default
Experimental: true
Server: Docker Desktop 4.5.0 (74594)
Engine:
Version: 20.10.12
API version: 1.41 (minimum version 1.12)
Go version: go1.16.12
Git commit: 459d0df
Built: Mon Dec 13 11:43:56 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.12
GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Docker compose yaml
version: "3.3"
services:
nuget:
build:
context: docker_image
args:
BASE_IMAGE: "ubuntu:20.04"
image: nuget
volumes:
- /var/cache/nuget/v3-cache:/root/.local/share/NuGet/v3-cache
- /var/cache/nuget/packages:/root/.nuget/packages
- /tmp:/nuget_cache
working_dir: /nuget_cache
environment:
- NEXUS_PASSWORD
- PACKAGES
- USER=${USER}
command:
- /fetch.sh
Fetch script in the image
mono /nuget.exe sources add \
-NonInteractive -Verbosity detailed \
-name PackageSource_0 \
-configfile cfg.xml \
-source <my_source> \
-username ovation-tests -password "${NEXUS_PASSWORD}"
for pkg in ${PACKAGES};
do
echo "Installing ${pkg}..."
mono /nuget.exe install "${pkg}" \
-NonInteractive -Verbosity detailed \
-packagesavemode nuspec \
-OutputDirectory . \
-ConfigFile cfg.xml \
-source PackageSource_0
done

unknown command "images" for "docker"

I've installed docker in windows 10 successfully.
I can run docker version and see this result
$ docker version
Client: Docker Engine - Community
Cloud integration: 1.0.4
Version: 20.10.0
API version: 1.41
Go version: go1.13.15
Git commit: 7287ab3
Built: Tue Dec 8 18:55:31 2020
OS/Arch: windows/amd64
Context: myacicontext
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.0
API version: 1.41 (minimum version 1.24)
Go version: go1.13.15
Git commit: eeddea2
Built: Tue Dec 8 19:07:44 2020
OS/Arch: windows/amd64
Experimental: false
but when I run $ docker images I receive this error
unknown command "images" for "docker"
The problem is that you're not in the right context.
From your logs I can see that you're in the "acicontext" where the $ docker images command is not available. I had the same issue when I tried to deploy a container to Azure.
To resolve this, first, run the command $ docker context list in Powershell. You should be seeing a list of contexts and the one that you're on has a star right next to its name like so :
If you want to be able to use the $ docker images command you have to go inside the right context, which in this example is "default". To do so, run $ docker context use default
Then run $ docker images again, it should be working.
You can read more about Docker context here https://docs.docker.com/engine/context/working-with-contexts/
I had the same issue, and I had to uninstall and reinstall, wich

How I can I get HOST_IP for Docker using docker-machine?

I just got a new Mac. My old Mac had a shell script that included these lines:
ACTIVE=`docker-machine active 2>/dev/null`
HOST_IP=`docker-machine ip $ACTIVE`
When I run this on the new machine it doesn't work. Just running the docker-machine active command independently I get output like this:
No active host found
I figured I try to create a default with docker-machine create default, but got this:
dial-http tcp 127.0.0.1:49719: unexpected EOF
I'm not sure what version of Docker my old Mac was running, but it was native. New Mac:
Client:
Version: 17.06.1-ce
API version: 1.30
Go version: go1.8.3
Git commit: 874a737
Built: Thu Aug 17 22:53:38 2017
OS/Arch: darwin/amd64
Server:
Version: 17.06.1-ce
API version: 1.30 (minimum version 1.12)
Go version: go1.8.3
Git commit: 874a737
Built: Thu Aug 17 22:54:55 2017
OS/Arch: linux/amd64
Experimental: true
New versions of Docker for Mac no longer user VirtualBox and docker-machine. It's running on xhyve and you can run docker commands very similar to if you were running docker natively on a linux host. There's still a VM under the covers (using moby), but your scripts shouldn't see that anymore. Anything you use to connect to published ports can now connect to localhost as if it is running directly on the Mac host.

Docker: Unable to find volume real location

I'm creating a Docker container with the following command:
docker run -v /data -d ubuntu
Afterwards I try to find out the real location of the volume with:
docker inspect 12345678
and it shows that it's in /var/lib/docker/volumes/0ef2ed2715456b767fe52d38a316074c3da4a6fa82e4e42e5595c8dd8b5f0440/_data
ls: /var/lib/docker/volumes/0ef2ed2715456----/_data:
But I don't actually have a /var/lib/docker directory.
What am I missing?
I'm using Docker 1.12 on Mac.
Client:
Version: 1.12.1
API version: 1.24
Go version: go1.7.1
Git commit: 6f9534c
Built: Thu Sep 8 10:31:18 2016
OS/Arch: darwin/amd64
Server:
Version: 1.12.1
API version: 1.24
Go version: go1.6.3
Git commit: 23cf638
Built: Thu Aug 18 17:52:38 2016
OS/Arch: linux/amd64
Docker on Mac runs a docker engine in a Linux VM, not your Mac OS, so you can't find the volume's mount point in your Mac OS file system. Please check my answer in this question: Docker Named Volume location Mac

Docker image load failed on mac, error is 'invalid argument'

When I execute 'docker load file', something was wrong:
XXXdeMacBook-Pro:~ wuxinming$ sudo docker load -i crm_mysql-0.1.tar
invalid argument
XXXdeMacBook-Pro:~ wuxinming$ docker version
Client:
Version: 1.12.0-rc2
API version: 1.24
Go version: go1.6.2
Git commit: 906eacd
Built: Fri Jun 17 20:35:33 2016
OS/Arch: darwin/amd64
Experimental: true
Server:
Version: 1.12.0-rc2
API version: 1.24
Go version: go1.6.2
Git commit: a7119de
Built: Fri Jun 17 22:09:20 2016
OS/Arch: linux/amd64
Experimental: true
The command works well on Windows and Linux, but not Mac.

Resources