Unraid Docker API


frakman1

Recommended Posts

@Squid

Can you please tell me what docker command I could run that returns the values in the table that gets displayed when I click on "Container SIze"?

image.png.fd3e37440d54c3f423e6df6652398333.png

 

I want to be able to graph the output of this data over time to see which containers are growing. I've already used the "limit-log-files" extra parameter trick but still see the docker.img file growing over time.

 

I've tried using "docker system df -v" among others but nothing has displayed a similar table as the "Container Size" one.

 

Edited by frakman1
Link to comment
10 minutes ago, frakman1 said:

@Squid

Can you please tell me what docker command I could run that returns the values in the table that gets displayed when I click on "Container SIze"?

image.png.fd3e37440d54c3f423e6df6652398333.png

 

I want to be able to graph the output of this data over time to see which containers are growing. I've already used the "limit-log-files" extra parameter trick but still see the docker file growing over time.

 

I've tried using "docker system df -v" among others but nothing has displayed a similar table as the "Container Size" one.

 

You can do this (its a bit slow on my system, be patient)

docker container ls -sa --format 'table {{.Names}}\t{{.Size}}'

 

If you want the full data you can drop the --format part.  -s means size, -a means all (so that it will show both active and inactive containers) 

Link to comment

Multiple commands are needed to get the info.  And it's not always 100% reliable due to how docker sometimes works, along with other overhead which is present in the docker.img file

 

But, you're looking at 

 docker ps -sa --format='{{.Names}}|{{.Size}}'

and 

docker inspect --format='{{.LogPath}}' NAME_OF_CONTAINER_HERE|xargs du -b 2>/dev/null |cut -f1

 

  • Like 1
Link to comment

I found the following ports using netstat but they don't look like the standard port numbers mentioned in the documentation (port 2375) and they are all ipv6.

@Squid Any ideas how to access the REST API remotely?

 

 

# netstat -tulpn | grep LISTEN | grep docker
tcp6       0      0 :::6090                 :::*                    LISTEN      20241/docker-proxy  
tcp6       0      0 :::8112                 :::*                    LISTEN      19128/docker-proxy  
tcp6       0      0 :::8118                 :::*                    LISTEN      19115/docker-proxy  
tcp6       0      0 :::58846                :::*                    LISTEN      19102/docker-proxy  
tcp6       0      0 :::6080                 :::*                    LISTEN      20255/docker-proxy  
tcp6       0      0 :::58946                :::*                    LISTEN      19074/docker-proxy  

 

Link to comment

I found a different workaround. Rather than trying to enable the HTTP REST API by changing the dockerd statup option, I decided to use the built-in feature of the docker client to use the ssh protocol to access a remote docker server. This requires that you've already setup public/private key ssh access to your UnRAID server (details here)

 

Once that is working, I can just run this from my client:

 

$docker -H ssh://root@tower:22 ps
CONTAINER ID        IMAGE                   COMMAND                  CREATED             STATUS                PORTS           blahh blah

 

Edited by frakman1
Link to comment
  • 2 years later...

a bit of a necro-post, but I was having a play around with this earlier, and to get it working you just need to put

 

DOCKER_OPTS="-H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock"

 

into /boot/config/docker.cfg

 

of course, you then get the warning...

 

Quote

WARNING: API is accessible on http://0.0.0.0:2376 without encryption.
         Access to the remote API is equivalent to root access on the host. Refer
         to the 'Docker daemon attack surface' section in the documentation for
         more information: https://docs.docker.com/go/attack-surface/

 

 

And the Docker Start Stop page in the UI cracks the whoops a bit as well....

 

I'm actually now moving onto using a dockersocket proxy container instead (tecnativa/docker-socket-proxy)

Edited by Meles Meles
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.