Docker runtime metrics in boot2docker - docker

As stated in this document, docker container's runtime matrix should be available at /sys/fs/cgroup/memory/lxc/<longid>/.
However, if I am using boot2docker image, I can only find a folder named docker under /sys/fs/cgroup/memory/ with some matrices.
$ ls /sys/fs/cgroup/memory/ -l
total 0
-rw-r--r-- 1 root root 0 Mar 25 08:39 cgroup.clone_children
--w--w--w- 1 root root 0 Mar 25 08:39 cgroup.event_control
-rw-r--r-- 1 root root 0 Mar 25 08:39 cgroup.procs
-r--r--r-- 1 root root 0 Mar 25 08:39 cgroup.sane_behavior
drwxr-xr-x 2 root root 0 Mar 25 07:41 docker/
-rw-r--r-- 1 root root 0 Mar 25 08:39 memory.failcnt
--w------- 1 root root 0 Mar 25 08:39 memory.force_empty
-rw-r--r-- 1 root root 0 Mar 25 08:39 memory.kmem.failcnt
-rw-r--r-- 1 root root 0 Mar 25 08:39 memory.kmem.limit_in_bytes
-rw-r--r-- 1 root root 0 Mar 25 08:39 memory.kmem.max_usage_in_bytes
-r--r--r-- 1 root root 0 Mar 25 08:39 memory.kmem.slabinfo
-rw-r--r-- 1 root root 0 Mar 25 08:39 memory.kmem.tcp.failcnt
-rw-r--r-- 1 root root 0 Mar 25 08:39 memory.kmem.tcp.limit_in_bytes
-rw-r--r-- 1 root root 0 Mar 25 08:39 memory.kmem.tcp.max_usage_in_bytes
-r--r--r-- 1 root root 0 Mar 25 08:39 memory.kmem.tcp.usage_in_bytes
-r--r--r-- 1 root root 0 Mar 25 08:39 memory.kmem.usage_in_bytes
-rw-r--r-- 1 root root 0 Mar 25 04:00 memory.limit_in_bytes
-rw-r--r-- 1 root root 0 Mar 25 08:39 memory.max_usage_in_bytes
-rw-r--r-- 1 root root 0 Mar 25 08:39 memory.memsw.failcnt
-rw-r--r-- 1 root root 0 Mar 25 04:00 memory.memsw.limit_in_bytes
-rw-r--r-- 1 root root 0 Mar 25 08:39 memory.memsw.max_usage_in_bytes
-r--r--r-- 1 root root 0 Mar 25 08:39 memory.memsw.usage_in_bytes
-rw-r--r-- 1 root root 0 Mar 25 08:39 memory.move_charge_at_immigrate
-rw-r--r-- 1 root root 0 Mar 25 08:39 memory.oom_control
---------- 1 root root 0 Mar 25 08:39 memory.pressure_level
-rw-r--r-- 1 root root 0 Mar 25 04:00 memory.soft_limit_in_bytes
-r--r--r-- 1 root root 0 Mar 25 08:39 memory.stat
-rw-r--r-- 1 root root 0 Mar 25 08:39 memory.swappiness
-r--r--r-- 1 root root 0 Mar 25 08:39 memory.usage_in_bytes
-rw-r--r-- 1 root root 0 Mar 25 08:39 memory.use_hierarchy
-rw-r--r-- 1 root root 0 Mar 25 08:39 notify_on_release
-rw-r--r-- 1 root root 0 Mar 25 08:39 release_agent
-rw-r--r-- 1 root root 0 Mar 25 08:39 tasks
How can I get back the missing LXC matrices in boot2docker image?

Related

is docker changing ownership of files?

Our deployment model is that we create containers on the fly with docker-java-api, some of these containers use heavily rocksdb database. The files of the DB are on the host, like:
ls -lrt /mnt/data/rocksdb
-rw-r--r-- 1 root root 8374 Nov 28 15:32 fileA
-rw-r--r-- 1 root root 0 Nov 28 15:32 fileB
-rw-r--r-- 1 root root 37 Nov 28 15:32 ....
-rw-r--r-- 1 root root 16 Nov 28 15:32 fileC
-rw-r--r-- 1 root root 19646 Nov 28 15:32 ..
-rw-r--r-- 1 root root 22500 Nov 28 15:32 .... etc
/mnt/data/rocksdb gets mounted onto a container with app that uses the DB heavily.
What I notice is that after starting the container, ownership of the files changes to:
ls -lrnt /mnt/data/rocksdbdata/
total 84092
-rw-r--r-- 1 999 999 8374 Nov 28 15:32 fileA
-rw-r--r-- 1 999 999 0 Nov 28 15:32 LOCK
-rw-r--r-- 1 999 999 37 Nov 28 15:32 fileB
-rw-r--r-- 1 999 999 16 Nov 28 15:32 fileC
-rw-r--r-- 1 999 999 19646 Nov 28 15:32 ...
-rw-r--r-- 1 999 999 22500 Nov 28 15:32 .....etc
User with these UID:GID (999:999) is docker.
Can you tell me why is this happening?
It needs a long explanation. Long story short, docker is changing the mounted file permissions because of access with root permissions.
For more details, please look at this answer;
Docker changes owner of local files mounted as volume

sphinx search: how to understand min_prefix_len

Sorry I post my question here as I permanently get an error on the sphinxsearch forum where it belongs to.
I have set min_prefix_len = 3.
According to http://sphinxsearch.com/docs/current/conf-min-prefix-len.html I expect a match for
val*
but I do not even get a match for
vale*
however I get all matches for
valeg*
valegr*
valegro*
What is it that I do not understand?
I'm sorry, now it works like it should. Possible explanation is an error in the index. While exploring manticore as an alternative to sphinx, I reindexed and by chance noticed that rotation did not occur although the indexer said so:
rotating indices: successfully sent SIGHUP to searchd (pid=8).
But looking at the disk proved that this was not the case:
# ls -latrh /d/data/sphinx/*sm_en*
-rw-r--r-- 1 root root 0 Jul 29 04:43 /d/data/sphinx/lng_sm_en.spm
-rw-r--r-- 1 root root 31K Jul 29 04:43 /d/data/sphinx/lng_sm_en.spa
-rw-r--r-- 1 root root 0 Jul 29 04:43 /d/data/sphinx/lng_sm_en.spk
-rw-r--r-- 1 root root 607K Jul 29 04:43 /d/data/sphinx/lng_sm_en.spi
-rw-r--r-- 1 root root 5.7M Jul 29 04:43 /d/data/sphinx/lng_sm_en.spd
-rw-r--r-- 1 root root 11M Jul 29 04:43 /d/data/sphinx/lng_sm_en.spp
-rw-r--r-- 1 root root 30M Jul 29 04:43 /d/data/sphinx/lng_sm_en.sps
-rw-r--r-- 1 root root 823 Jul 29 04:43 /d/data/sphinx/lng_sm_en.sph
-rw-r--r-- 1 root root 38K Jul 29 04:43 /d/data/sphinx/lng_sm_en.spe
-rw------- 1 root root 0 Jul 29 04:43 /d/data/sphinx/lng_sm_en.spl
-rw-r--r-- 1 root root 0 Jul 31 00:36 /d/data/sphinx/lng_sm_en.new.spm
-rw-r--r-- 1 root root 31K Jul 31 00:36 /d/data/sphinx/lng_sm_en.new.spa
-rw-r--r-- 1 root root 0 Jul 31 00:36 /d/data/sphinx/lng_sm_en.new.spk
-rw-r--r-- 1 root root 11M Jul 31 00:36 /d/data/sphinx/lng_sm_en.new.spp
-rw-r--r-- 1 root root 607K Jul 31 00:36 /d/data/sphinx/lng_sm_en.new.spi
-rw-r--r-- 1 root root 5.7M Jul 31 00:36 /d/data/sphinx/lng_sm_en.new.spd
-rw-r--r-- 1 root root 823 Jul 31 00:36 /d/data/sphinx/lng_sm_en.new.sph
-rw-r--r-- 1 root root 30M Jul 31 00:36 /d/data/sphinx/lng_sm_en.new.sps
-rw-r--r-- 1 root root 38K Jul 31 00:36 /d/data/sphinx/lng_sm_en.new.spe
-rw------- 1 root root 0 Jul 31 00:36 /d/data/sphinx/lng_sm_en.new.spl
So I deleted these files and indexed again. Probably this fixed the issue, as rotating works again as well.
As the filedates show, this problem must have been lingering for 2 weeks. Now the dates are correct, too.

cat: "Permission denied" inside a docker container for existing file with proper permissions

I'm new to docker and started with simple examples, but get "Permission denied":
Gyro#Helper:~$ sudo docker run prakhar1989/static-site sh -c 'echo foo > delete.me;echo bar >> delete.me;ls -l;type cat;ls -l /bin/cat;echo -n "I am ";whoami;cat delete.me'
total 72
drwxr-xr-x 2 root root 4096 Dec 4 2015 bin
drwxr-xr-x 2 root root 4096 Aug 26 2015 boot
-rw-r--r-- 1 root root 8 Feb 15 15:38 delete.me
drwxr-xr-x 5 root root 340 Feb 15 15:38 dev
drwxr-xr-x 1 root root 4096 Feb 15 15:38 etc
drwxr-xr-x 2 root root 4096 Aug 26 2015 home
drwxr-xr-x 9 root root 4096 Nov 27 2014 lib
drwxr-xr-x 2 root root 4096 Dec 4 2015 lib64
drwxr-xr-x 2 root root 4096 Dec 4 2015 media
drwxr-xr-x 2 root root 4096 Dec 4 2015 mnt
drwxr-xr-x 2 root root 4096 Dec 4 2015 opt
dr-xr-xr-x 271 root root 0 Feb 15 15:38 proc
drwx------ 2 root root 4096 Dec 4 2015 root
drwxr-xr-x 3 root root 4096 Dec 4 2015 run
drwxr-xr-x 2 root root 4096 Dec 4 2015 sbin
drwxr-xr-x 2 root root 4096 Dec 4 2015 srv
dr-xr-xr-x 13 root root 0 Dec 26 11:32 sys
drwxrwxrwt 1 root root 4096 Dec 16 2015 tmp
drwxr-xr-x 1 root root 4096 Jan 3 2016 usr
drwxr-xr-x 1 root root 4096 Dec 16 2015 var
-rwxr-xr-x 1 root root 69 Jan 3 2016 wrapper.sh
cat is /bin/cat
-rwxr-xr-x 1 root root 51912 Mar 14 2015 /bin/cat
I am root
cat: delete.me: Permission denied
The original problem was Permission denied on wrapper.sh so I played around a bit to get more information on the problem.
The code and result above tells me that I can create a file named delete.me, append contents, see the file via ls, can check that cat is /bin/cat and has execute permission. I am logged in into the container as user root, but cat won't obey.
Is it a bug?
docker info gives:
Gyro#Helper:~$ sudo docker info
Containers: 38
Running: 0
Paused: 0
Stopped: 38
Images: 5
Server Version: 18.09.9
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: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc version: N/A
init version: fec3683
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.0.0-32-generic
Operating System: Ubuntu Core 16
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.08GiB
Name: x260
ID: JCNS:55GU:FMFK:GJGF:JQ2P:IMSA:JOW2:JT5L:VQOB:QG4C:2NU5:Z6DR
Docker Root Dir: /var/snap/docker/common/var-lib-docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: No swap limit support
Thanks to the help of #JohnKugelman it works now.
Key thing is not to call
sudo snap install docker
but
sudo apt install docker.io
Gyro#Helper:~$ sudo snap remove docker
docker removed
Gyro#Helper:~$ sudo docker run prakhar1989/static-site sh -c 'echo foo > delete.me;echo bar >> delete.me;ls -l;type cat;ls -l /bin/cat;echo -n "I am ";whoami;cp delete.me newfile.del;ls -alrt'
sudo: docker: command not found
Gyro#Helper:~$ docker
Command 'docker' not found, but can be installed with:
sudo snap install docker # version 18.09.9, or
See 'snap info docker' for additional versions.
Gyro#Helper:~$ sudo apt install docker.io
Reading package lists... Done
(stuff deleted)
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
7[0;51r8[1A[JGyro#Helper:~$
Gyro#Helper:~$ sudo docker run prakhar1989/static-site sh -c 'echo foo > delete.me;echo bar >> delete.me;ls -l;type cat;ls -l /bin/cat;echo -n "I am ";whoami;cp delete.me newfile.del;ls -alrt'
Unable to find image 'prakhar1989/static-site:latest' locally
latest: Pulling from prakhar1989/static-site
(download progress deleted)
total 72
drwxr-xr-x 2 root root 4096 Dec 4 2015 bin
drwxr-xr-x 2 root root 4096 Aug 26 2015 boot
-rw-r--r-- 1 root root 8 Feb 15 17:16 delete.me
drwxr-xr-x 5 root root 340 Feb 15 17:16 dev
drwxr-xr-x 1 root root 4096 Feb 15 17:16 etc
drwxr-xr-x 2 root root 4096 Aug 26 2015 home
drwxr-xr-x 9 root root 4096 Nov 27 2014 lib
drwxr-xr-x 2 root root 4096 Dec 4 2015 lib64
drwxr-xr-x 2 root root 4096 Dec 4 2015 media
drwxr-xr-x 2 root root 4096 Dec 4 2015 mnt
drwxr-xr-x 2 root root 4096 Dec 4 2015 opt
dr-xr-xr-x 292 root root 0 Feb 15 17:16 proc
drwx------ 2 root root 4096 Dec 4 2015 root
drwxr-xr-x 3 root root 4096 Dec 4 2015 run
drwxr-xr-x 2 root root 4096 Dec 4 2015 sbin
drwxr-xr-x 2 root root 4096 Dec 4 2015 srv
dr-xr-xr-x 13 root root 0 Dec 26 11:32 sys
drwxrwxrwt 1 root root 4096 Dec 16 2015 tmp
drwxr-xr-x 1 root root 4096 Jan 3 2016 usr
drwxr-xr-x 1 root root 4096 Dec 16 2015 var
-rwxr-xr-x 1 root root 69 Jan 3 2016 wrapper.sh
cat is /bin/cat
-rwxr-xr-x 1 root root 51912 Mar 14 2015 /bin/cat
I am root
total 84
drwxr-xr-x 9 root root 4096 Nov 27 2014 lib
drwxr-xr-x 2 root root 4096 Aug 26 2015 home
drwxr-xr-x 2 root root 4096 Aug 26 2015 boot
drwxr-xr-x 2 root root 4096 Dec 4 2015 srv
drwxr-xr-x 3 root root 4096 Dec 4 2015 run
drwx------ 2 root root 4096 Dec 4 2015 root
drwxr-xr-x 2 root root 4096 Dec 4 2015 opt
drwxr-xr-x 2 root root 4096 Dec 4 2015 mnt
drwxr-xr-x 2 root root 4096 Dec 4 2015 media
drwxr-xr-x 2 root root 4096 Dec 4 2015 lib64
drwxr-xr-x 2 root root 4096 Dec 4 2015 bin
drwxr-xr-x 2 root root 4096 Dec 4 2015 sbin
drwxrwxrwt 1 root root 4096 Dec 16 2015 tmp
drwxr-xr-x 1 root root 4096 Dec 16 2015 var
-rwxr-xr-x 1 root root 69 Jan 3 2016 wrapper.sh
drwxr-xr-x 1 root root 4096 Jan 3 2016 usr
dr-xr-xr-x 13 root root 0 Dec 26 11:32 sys
drwxr-xr-x 1 root root 4096 Feb 15 17:16 etc
-rwxr-xr-x 1 root root 0 Feb 15 17:16 .dockerenv
dr-xr-xr-x 290 root root 0 Feb 15 17:16 proc
drwxr-xr-x 5 root root 340 Feb 15 17:16 dev
-rw-r--r-- 1 root root 8 Feb 15 17:16 delete.me
-rw-r--r-- 1 root root 8 Feb 15 17:16 newfile.del
drwxr-xr-x 1 root root 4096 Feb 15 17:16 ..
drwxr-xr-x 1 root root 4096 Feb 15 17:16 .
Gyro#Helper:~$ sudo docker run prakhar1989/static-site sh -c 'echo foo > delete.me;echo bar >> delete.me;ls -l;type cat;ls -l /bin/cat;echo -n "I am ";whoami;cat delete.me;ls -alrt'
total 72
drwxr-xr-x 2 root root 4096 Dec 4 2015 bin
drwxr-xr-x 2 root root 4096 Aug 26 2015 boot
-rw-r--r-- 1 root root 8 Feb 15 17:17 delete.me
drwxr-xr-x 5 root root 340 Feb 15 17:17 dev
drwxr-xr-x 1 root root 4096 Feb 15 17:17 etc
drwxr-xr-x 2 root root 4096 Aug 26 2015 home
drwxr-xr-x 9 root root 4096 Nov 27 2014 lib
drwxr-xr-x 2 root root 4096 Dec 4 2015 lib64
drwxr-xr-x 2 root root 4096 Dec 4 2015 media
drwxr-xr-x 2 root root 4096 Dec 4 2015 mnt
drwxr-xr-x 2 root root 4096 Dec 4 2015 opt
dr-xr-xr-x 291 root root 0 Feb 15 17:17 proc
drwx------ 2 root root 4096 Dec 4 2015 root
drwxr-xr-x 3 root root 4096 Dec 4 2015 run
drwxr-xr-x 2 root root 4096 Dec 4 2015 sbin
drwxr-xr-x 2 root root 4096 Dec 4 2015 srv
dr-xr-xr-x 13 root root 0 Dec 26 11:32 sys
drwxrwxrwt 1 root root 4096 Dec 16 2015 tmp
drwxr-xr-x 1 root root 4096 Jan 3 2016 usr
drwxr-xr-x 1 root root 4096 Dec 16 2015 var
-rwxr-xr-x 1 root root 69 Jan 3 2016 wrapper.sh
cat is /bin/cat
-rwxr-xr-x 1 root root 51912 Mar 14 2015 /bin/cat
I am root
foo
bar
total 80
drwxr-xr-x 9 root root 4096 Nov 27 2014 lib
drwxr-xr-x 2 root root 4096 Aug 26 2015 home
drwxr-xr-x 2 root root 4096 Aug 26 2015 boot
drwxr-xr-x 2 root root 4096 Dec 4 2015 srv
drwxr-xr-x 3 root root 4096 Dec 4 2015 run
drwx------ 2 root root 4096 Dec 4 2015 root
drwxr-xr-x 2 root root 4096 Dec 4 2015 opt
drwxr-xr-x 2 root root 4096 Dec 4 2015 mnt
drwxr-xr-x 2 root root 4096 Dec 4 2015 media
drwxr-xr-x 2 root root 4096 Dec 4 2015 lib64
drwxr-xr-x 2 root root 4096 Dec 4 2015 bin
drwxr-xr-x 2 root root 4096 Dec 4 2015 sbin
drwxrwxrwt 1 root root 4096 Dec 16 2015 tmp
drwxr-xr-x 1 root root 4096 Dec 16 2015 var
-rwxr-xr-x 1 root root 69 Jan 3 2016 wrapper.sh
drwxr-xr-x 1 root root 4096 Jan 3 2016 usr
dr-xr-xr-x 13 root root 0 Dec 26 11:32 sys
drwxr-xr-x 1 root root 4096 Feb 15 17:17 etc
-rwxr-xr-x 1 root root 0 Feb 15 17:17 .dockerenv
dr-xr-xr-x 289 root root 0 Feb 15 17:17 proc
drwxr-xr-x 5 root root 340 Feb 15 17:17 dev
-rw-r--r-- 1 root root 8 Feb 15 17:17 delete.me
drwxr-xr-x 1 root root 4096 Feb 15 17:17 ..
drwxr-xr-x 1 root root 4096 Feb 15 17:17 .
Gyro#Helper:~$ sudo docker run --rm prakhar1989/static-site
Nginx is running...

Docker: Where is the image stored in Ubuntu

I created a Docker image.
Its repository name is docker-hello-world and its Docker Image ID is e127d87570f9.
I understood that it should be placed in /var/lib/docker/overlay2/, but when I open this folder this is what I see:
$ sudo ls -alF /var/lib/docker/overlay2/
total 40
drwx------ 10 root root 4096 Dec 28 17:28 ./
drwx--x--x 14 root root 4096 Dec 28 01:35 ../
drwx------ 3 root root 4096 Dec 28 01:35 0a6ee9708ef2529b105ae04ee9279877f23a3408d81ea58433e34f9e278fd90e/
drwx------ 4 root root 4096 Dec 28 17:28 17c9c50edb4ecc6ffd47a688720dfe1b7f5d407ac9eb8f2b0ec5e62eccf9400f/
drwx------ 4 root root 4096 Dec 28 01:36 5fd838043c830a61c6efeeec62c1c1cca9d500556faca5870c526b0a34766a63/
drwx------ 4 root root 4096 Dec 28 01:35 5fd838043c830a61c6efeeec62c1c1cca9d500556faca5870c526b0a34766a63-init/
drwx------ 4 root root 4096 Dec 28 17:28 820dc021f10e31423aaba6ada86fbc06a03aa531d277c5de598e101dd2cd9881/
drwx------ 3 root root 4096 Dec 28 17:28 cfc4379bcf9885bd305fae0f85368941b863bb7533db4d088ffcd397b86f2182/
drwx------ 4 root root 4096 Dec 28 17:28 fa4ffb5887a1cbde6b3e58505119043ec891754bb3d797f1aedf68292c52477b/
drwx------ 2 root root 4096 Dec 28 17:28 l/
Do you know where to look for the image file?

Limit GPU usage in nvidia-docker?

I am setting up an internal Jupyterhub on a multi GPU server. Jupyter access is provided through a docker instance. I'd like to limit access for each user to no more than a single GPU. I'd appreciate any suggestion or comment. Thanks.
You can try it with nvidia-docker-compose
version: "2"
services
process1:
image: nvidia/cuda
devices:
- /dev/nvidia0
The problem can be solved in this way, just add the environment variable “NV_GPU” before “nvidia-docker” as follow:
[root#bogon ~]# NV_GPU='4,5' nvidia-docker run -dit --name tf_07 tensorflow/tensorflow:latest-gpu /bin/bash
e04645c2d7ea658089435d64e72603f69859a3e7b6af64af005fb852473d6b56
[root#bogon ~]# docker attach tf_07
root#e04645c2d7ea:/notebooks#
root#e04645c2d7ea:/notebooks# ll /dev
total 4
drwxr-xr-x 5 root root 460 Dec 29 03:52 ./
drwxr-xr-x 22 root root 4096 Dec 29 03:52 ../
crw--w---- 1 root tty 136, 0 Dec 29 03:53 console
lrwxrwxrwx 1 root root 11 Dec 29 03:52 core -> /proc/kcore
lrwxrwxrwx 1 root root 13 Dec 29 03:52 fd -> /proc/self/fd/
crw-rw-rw- 1 root root 1, 7 Dec 29 03:52 full
drwxrwxrwt 2 root root 40 Dec 29 03:52 mqueue/
crw-rw-rw- 1 root root 1, 3 Dec 29 03:52 null
crw-rw-rw- 1 root root 245, 0 Dec 29 03:52 nvidia-uvm
crw-rw-rw- 1 root root 245, 1 Dec 29 03:52 nvidia-uvm-tools
crw-rw-rw- 1 root root 195, 4 Dec 29 03:52 nvidia4
crw-rw-rw- 1 root root 195, 5 Dec 29 03:52 nvidia5
crw-rw-rw- 1 root root 195, 255 Dec 29 03:52 nvidiactl
lrwxrwxrwx 1 root root 8 Dec 29 03:52 ptmx -> pts/ptmx
drwxr-xr-x 2 root root 0 Dec 29 03:52 pts/
crw-rw-rw- 1 root root 1, 8 Dec 29 03:52 random
drwxrwxrwt 2 root root 40 Dec 29 03:52 shm/
lrwxrwxrwx 1 root root 15 Dec 29 03:52 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Dec 29 03:52 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Dec 29 03:52 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root root 5, 0 Dec 29 03:52 tty
crw-rw-rw- 1 root root 1, 9 Dec 29 03:52 urandom
crw-rw-rw- 1 root root 1, 5 Dec 29 03:52 zero
root#e04645c2d7ea:/notebooks#
or,read nvidia-docker of github's wiki
There are 3 options.
Docker with NVIDIA RUNTIME (version 2.0.x)
According to official documentation
docker run --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=2,3
nvidia-docker (version 1.0.x)
based on a popular post
nvidia-docker run .... -e CUDA_VISIBLE_DEVICES=0,1,2
(it works with tensorflow)
programmatically
import os
os.environ["CUDA_VISIBLE_DEVICES"]="0,1,2"

Resources