Creating hardlinks in docker container takes long the first time - performance

I am creating hard links of all the files in a directory (some 500MB) in a docker container using following command:
cp -al source destination
Interestingly, when I issue the above command the first time (i.e. when there is no hardlink for each file in that directory), it takes quite a long time. This is not the case when I issue the above command again to create hardlinks of same files in other destination. This is also not the case when I do that in my docker host (even if it's the first hardlink that is being created).
My docker container uses overlay2 as the storage driver. Here is my docker info output
Containers: 61
Running: 1
Paused: 0
Stopped: 60
Images: 142
Server Version: 1.13.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: journald
Cgroup Driver: systemd
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Authorization: rhel-push-plugin
Swarm: inactive
Runtimes: runc oci
Default Runtime: oci
Init Binary: /usr/libexec/docker/docker-init-current
containerd version: fbadd789ddf86a4be9d6905528b7486c61e52612 (expected: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1)
runc version: fbadd789ddf86a4be9d6905528b7486c61e52612-dirty (expected: 9df8b306d01f59d3a8029be411de015b7304dd8f)
init version: N/A (expected: 949e6facb77383876aeff8a6944dde66b3089574)
Security Options:
seccomp
WARNING: You're not using the default seccomp profile
Profile: /etc/docker/seccomp.json
selinux
Kernel Version: 4.14.13-300.fc27.x86_64
Operating System: Fedora 27 (Workstation Edition)
OSType: linux
Architecture: x86_64
Number of Docker Hooks: 3
CPUs: 8
Total Memory: 15.58 GiB
Name: pranavk.local.me
ID: STYG:PZCA:FMHL:FLCU:N7VG:Z463:KYQF:QVHO:KWKP:FHTY:EUBA:QBUK
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Registries: docker.io (secure), registry.fedoraproject.org (secure), registry.access.redhat.com (secure), docker.io (secure)
Edit:
If I remove all the hardlinks and then issue above cp command again, it's fast again. Phew!
I am not sure what's causing this or from where I should start looking from.

Related

Docker build crashes whole machine when transferring build context

My machine crashes when I try to build an docker image. I can only build once and then the machine crashes when I try to start a second build.
It always starts and then starts to transfer to the build context, and around the 150-170mb mark it locks up the machine needing a restart to get it back.
I have not been able to find any logs regarding to any errors so I am completely in the dark.
I am running Ubuntu 22.04.1 LTS
In the codeblock below you can find the system specifications
docker info output:
Client:
Context: default
Debug Mode: false
Plugins:
app: Docker App (Docker Inc., v0.9.1-beta3)
buildx: Docker Buildx (Docker Inc., v0.9.1-docker)
compose: Docker Compose (Docker Inc., v2.10.2)
scan: Docker Scan (Docker Inc., v0.17.0)
Server:
Containers: 13
Running: 0
Paused: 0
Stopped: 13
Images: 189
Server Version: 20.10.18
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2
Default Runtime: runc
Init Binary: docker-init
containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6
runc version: v1.1.4-0-g5fd4c4d
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: default
cgroupns
Kernel Version: 5.15.0-47-generic
Operating System: Ubuntu 22.04.1 LTS
OSType: linux
Architecture: x86_64
CPUs: 12 (Added by Author: Model Intel Core i5-11400H)
Total Memory: 15.36GiB
Name: SHENZHOU
ID: RA4Z:367M:Z7EV:ODMX:IT5C:ZARV:NAAO:KZHX:D3VN:544G:UWA7:U27Q
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false

Cannot connect to the Docker daemon at unix:///var/run/docker.sock on OSX

I've created a Scala project that creates a testcontainer (via com.dimafeng.testcontainers) with two Docker's containers (singularities/datastore-emulator and bigtruedata/gcloud-pubsub-emulator). The testcontainer is successfully created, when I run the docker ps command this is what I see:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ddc16471205a quay.io/testcontainers/ryuk:0.2.2 "/app" 2 minutes ago Up 2 minutes 0.0.0.0:32771->8080/tcp testcontainers-ryuk-371a41c2-3d23-426f-943d-608a816c96d3
Now, the problem occurs when I try to run the container:
$ docker run -p 4000:80 quay.io/testcontainers/ryuk:0.2.2
2018/12/13 10:59:48 Starting on port 8080...
panic: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
goroutine 1 [running]:
main.main()
/go/src/github.com/bsideup/moby-ryuk/main.go:31 +0xe2e
And if I go inside the container and run the /app command this is what I get:
$ docker exec -it ddc /bin/sh
/ # /app
2018/12/13 11:40:55 Starting on port 8080...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x64f8d6]
goroutine 9 [running]:
main.main.func1(0xc4200685a0, 0xc4201bd890, 0xc420068600)
/go/src/github.com/bsideup/moby-ryuk/main.go:42 +0x286
created by main.main
/go/src/github.com/bsideup/moby-ryuk/main.go:39 +0x1b5
I've tried literally everything from setting the docker-machine eval default to check all the possible permissions problems. What am I missing?
(I have no access at all to the go files present in the errors)
Here's the information about my docker installation
$ docker version
Client: Docker Engine - Community
Version: 18.09.0
API version: 1.39
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:47:43 2018
OS/Arch: darwin/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.0
API version: 1.39 (minimum version 1.12)
Go version: go1.10.4
Git commit: 4d60db4
Built: Wed Nov 7 00:55:00 2018
OS/Arch: linux/amd64
Experimental: false
And the infos
$ docker info
Containers: 19
Running: 1
Paused: 0
Stopped: 18
Images: 7
Server Version: 18.09.0
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 468a545b9edcd5932818eb9de8e72413e616e86e
runc version: 69663f0bd4b60df09991c08812a60108003fa340
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.125-linuxkit
Operating System: Docker for Mac
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952GiB
Name: linuxkit-025000000001
ID: 5XHJ:QGZD:4I55:WLU6:RLUF:E5XL:XFUL:PMBB:D432:IJFX:EUPG:QEVW
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 33
Goroutines: 58
System Time: 2018-12-13T11:34:52.2335167Z
EventsListeners: 2
HTTP Proxy: gateway.docker.internal:3128
HTTPS Proxy: gateway.docker.internal:3129
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine

docker.exe: invalid reference format

I don't understand what's the problem ?
I installed Docker on Win10. This is my first experience with it.
I read the manuals, start hello-world, and more.
Next, I need to use the command mvn compile in the folder of the repository. For this needed to install Mavin.
I see this: https://hub.docker.com/_/maven/ and used:
docker run -it --rm --name my-maven-project -v "$PWD":/usr/src/mymaven -w /usr/src/mymaven maven:3.2-jdk-7 mvn clean install
... and I get the output
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: invalid reference format.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.
Output docker version
Client:
Version: 17.09.0-ce
API version: 1.32
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:40:09 2017
OS/Arch: windows/amd64
Server:
Version: 17.09.0-ce
API version: 1.32 (minimum version 1.12)
Go version: go1.8.3
Git commit: afdb6d4
Built: Tue Sep 26 22:45:38 2017
OS/Arch: linux/amd64
Experimental: true
Output docker info
Containers: 4
Running: 0
Paused: 0
Stopped: 4
Images: 3
Server Version: 17.09.0-ce
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 06b9cb35161009dcb7123345749fef02f7cea8e0
runc version: 3f2f8b84a77f73d38244dd690525642a72156c64
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 4.9.49-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.934GiB
Name: moby
ID: O3WT:CHTU:34YG:IYV3:OELC:RSAW:WSYD:E3HV:2ZUO:DWBU:JXOB:EN4Y
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 16
Goroutines: 26
System Time: 2017-10-25T18:44:10.1162161Z
EventsListeners: 0
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Sorry for the stupid question, first time working with Docker... Thanks!
You need to use the right syntax for the current folder, in the right environment:
in a simple CMD shell session, you would use:
-v "%cd%":/usr/src/mymaven
in a Powershell session
-v ${PWD}:/usr/src/mymaven
I had a situation:
the dash was Unicode dash not ASCII minus (need to retype the dashes)
‐ 8208 2010 HYPHEN
‑ 8209 2011 NON-BREAKING HYPHEN
‒ 8210 2012 FIGURE DASH
– 8211 2013 – EN DASH
— 8212 2014 — EM DASH
― 8213 2015 HORIZONTAL BAR
You can use the below syntax on PowerShell:
docker run --name mc1 -d -p 8001:83 imagename
mc1- name of the running instance
8001:83 - port

Docker swarm manager pending status

I have 2 windows 2016 server with container services enabled. I have installed docker in both the machines.
Now I am trying to install docker cluster swarm mode. But when run:
docker swarm init --advertise-addr 192.168.233.131 > test.txt
it is stuck and does not display any output.
When I run docker info, it showing
Swarm: pending ( manager node).
Kindly help me to resolve. What have I missed?
Containers: 6 Running: 0 Paused: 0 Stopped: 6 Images: 5 Server
Version: 17.03.0-ee-1 Storage Driver: windowsfilter Windows: Logging
Driver: json-file Plugins: Volume: local Network: l2bridge l2tunnel
nat null overlay transparent Swarm: pending NodeID: l0cavlw31jzh4xbg34gqkubah Is Manager: true ClusterID:
bi188mb7kcd0ct87c1ia1xha3 Managers: 1 Nodes: 1 Orchestration:
Task History Retention Limit: 5 Raft: Snapshot Interval: 10000
Number of Old Snapshots to Retain: 0 Heartbeat Tick: 1 Election
Tick: 3 Dispatcher: Heartbeat Period: 5 seconds CA Configuration:
Expiry Duration: 3 months Node Address: 192.168.233.131 Manager
Addresses:
0.0.0.0:2377 Default Isolation: process Kernel Version: 10.0 14393 (14393.1480.amd64fre.rs1_release.170706-2004) Operating System:
Windows Server 2016 Standard OSType: windows Architecture: x86_64
CPUs: 1 Total Memory: 1.999 GiB Name: WIN-NGCG1EF8Q2E ID:
EAT6:KLZD:BQAY:TXGV:4LR4:POTH:3VSJ:OEQO:TBAN:L322:QFNC:4V3J Docker
Root Dir: C:\ProgramData\docker Debug Mode (client): false Debug Mode
(server): false Registry: https://index.docker.io/v1/ Experimental:
false Insecure Registries:
127.0.0.0/8 Live Restore Enabled: false
C:\> docker swarm init --advertise-addr=HOSTIPADDRESS --listen-addr HOSTIPADDRESS:2377
i have typed the above command format it works thanks #Tarun Lalwani

Default docker machine on Mac

I'm a bit confused about the default docker machine on Mac.
Currently, my docker-machine ls shows a machine called default but it's not running. And yet I can still run containers without a problem. I believe what happened was I was having problem with the default setup and I rm and created the default machine. But apparently default is NOT the default machine because when I switch to it with eval $(docker-machine env default) I see completely different images and containers.
What is the default docker machine on Mac?
Here is my versions:
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 info output:
Containers: 15
Running: 1
Paused: 0
Stopped: 14
Images: 52
Server Version: 1.12.1
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 270
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: host overlay null bridge
Swarm: active
NodeID: exto91f6u59r77znpa3kj9ufp
Is Manager: true
ClusterID: 5my0ngxiaozvdt6s44icecy4y
Managers: 1
Nodes: 1
Orchestration:
Task History Retention Limit: 5
Raft:
Snapshot Interval: 10000
Heartbeat Tick: 1
Election Tick: 3
Dispatcher:
Heartbeat Period: 5 seconds
CA Configuration:
Expiry Duration: 3 months
Node Address: 192.168.65.2
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.4.20-moby
Operating System: Alpine Linux v3.4
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.953 GiB
Name: moby
ID: 3QHL:JAAF:XUSR:KR5Q:APNG:Z4LN:XSFR:53YC:6VBQ:DZJE:DM6G:MWXY
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 38
Goroutines: 128
System Time: 2016-10-23T02:24:34.36197692Z
EventsListeners: 1
Username: yijian
Registry: https://index.docker.io/v1/
Insecure Registries:
127.0.0.0/8
Probably you upgraded to docker for mac which no longer use docker-machine to emulate a docker environment in Mac.
You can still use docker-machine primarily for manage remote docker engines.
Regards

Resources