Docker Community Forums

Share and learn in the Docker community.

Running hello world container takes >10 sec on Ubuntu


I am trying to use docker with AWS sam, to test lambdas locally, but the containers are pretty slow to start.

On Ubuntu 18.04, it takes an average of 12 sec to run the hello world container:

time docker run hello-world

real	0m13.262s
user	0m0.039s
sys	    0m0.027s

I find this a bit excesive, given that my PC is an i7 with 16GB of ram, and I am not running anything “big” on the background.

I apologise in advance for asking, but can I get some hint on how to get docker running faster?

Thanks in advance,

What I tried

I tried running the command with --network none option and it improves the situation a bit, but it still takes 7 seconds on average (still too long).

I found a post that mentioned that setting the local DNS config to google’s DNS helped, I tried that, but it did not make a difference.

I checked this post, but this seems to be an issue on SSD disks, and I am currently running from a magnetic disk.

Also, I tried downgrading the kernel of my ubuntu machine to 4.15.0 to see if the kernel version was causing trouble, but it had no effect.

Here is my docker version:

 Version:           18.09.6
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        481bc77
 Built:             Sat May  4 02:35:57 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
  Version:          18.09.6
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.8
  Git commit:       481bc77
  Built:            Sat May  4 01:59:36 2019
  OS/Arch:          linux/amd64
  Experimental:     false

And docker info:

Containers: 37
 Running: 0
 Paused: 0
 Stopped: 37
Images: 2
Server Version: 18.09.6
Storage Driver: overlay2
 Backing Filesystem: extfs
 Supports d_type: true
 Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
 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: bb71b10fd8f58240ca47fbb579b9d1028eea7c84
runc version: 2b18fe1d885ee5083ef9f0838fee39b62d653e30
init version: fec3683
Security Options:
  Profile: default
Kernel Version: 4.19.16-041916-generic
Operating System: Ubuntu 18.04.2 LTS
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 15.37GiB
Name: morningstar
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Experimental: false
Insecure Registries:
Live Restore Enabled: false
Product License: Community Engine

WARNING: No swap limit support

Also, my pc is a Dell G7 15 7588

CPU: 2.2-GHz Intel Core i7-8750H
Memory: 16GB