Can't ping from container to external host (macOS)

I’m using Docker Desktop 4.5.0 on macOS 10.15.7. (I’m a relative newcomer to Docker)

I am building a container with a Python app that calls ping3 to 1.1.1.1. It’s reporting

ping fail 0 1645671113.1663935

And if I ssh into the running container to execute ping3 1.1.1.1 I get a permission error. Any thoughts about how to get the pings to work? Thanks.

Hi

I think we need a bit more info.
Can you share your Dockerfile or how you made this container?

Sure. Here’s the Dockerfile, built with docker build -t tkinter_in_docker .

I invoke with:

% docker run -u=$(id -u $USER):$(id -g $USER) \
           -e DISPLAY=host.docker.internal:0 \
           -v /tmp/.X11-unix:/tmp/.X11-unix:rw \
           -v $(pwd)/src/zoomready:/src \
           --rm \
           tkinter_in_docker

Source of zoomready.py is on Github Thanks!

# Slim version of Python
FROM python:3.8.12-slim

# Download Package Information
RUN apt-get update -y

# Install Tkinter
RUN apt-get install tk -y

# Install Python modules
RUN pip install --no-cache-dir -U numpy
RUN pip install --no-cache-dir -U psutil
RUN pip install --no-cache-dir -U ping3
RUN pip install --no-cache-dir -U cloudflarepycli

# Commands to run Tkinter application
CMD ["/src/zoomready.py"]
ENTRYPOINT ["python3"]

I will try and start my mac up later to test this, gave it a go on my linux box and it worked as expected.

Update: To simplify your experiment, change the CMD to refer to /src/zoomsimple.py and place this file in ./src/zoomready/zoomsimple.py This just executes time.sleep(1) forever.

You can then docker exec -it whatever-docker-name /bin/bash to issue ping3 1.1.1.1 to see the error (see below) Thanks!

# -*- coding: utf-8 -*-
"""
Created on Sat Nov 13 09:49:24 2021

@author: tevsl
"""
version="1.1.1"

import tkinter as tk
from tkinter import ttk
from tkinter import messagebox
import numpy as np
import time
import operator
import psutil
from datetime import timedelta
import webbrowser
import sys
import os
#import argparse    
import warnings
warnings.filterwarnings("ignore")
import ping3
ping3.EXCEPTIONS = True
import versionutils
from cloudflarepycli import cloudflareclass

while (1==1):
    time.sleep(1)

print("goodbye")

For clarity, the error message is:

I have no name!@7ae4bbe56412:/$ ping3 1.1.1.1
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/ping3/__init__.py", line 276, in ping
    sock = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_ICMP)
  File "/usr/local/lib/python3.8/socket.py", line 231, in __init__
    _socket.socket.__init__(self, family, type, proto, fileno)
PermissionError: [Errno 1] Operation not permitted

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/ping3", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/site-packages/ping3/command_line.py", line 33, in main
    ping3.verbose_ping(addr, count=args.count, ttl=args.ttl, timeout=args.timeout, size=args.size, interval=args.interval, interface=args.interface, src_addr=args.src_addr)
  File "/usr/local/lib/python3.8/site-packages/ping3/__init__.py", line 83, in wrapper
    func_return = func(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/ping3/__init__.py", line 346, in verbose_ping
    delay = ping(dest_addr, seq=i, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/ping3/__init__.py", line 83, in wrapper
    func_return = func(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/ping3/__init__.py", line 280, in ping
    sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_ICMP)
  File "/usr/local/lib/python3.8/socket.py", line 231, in __init__
    _socket.socket.__init__(self, family, type, proto, fileno)
PermissionError: [Errno 13] Permission denied
I have no name!@7ae4bbe56412:/$

Update: for even easier testing, clone this github repo: GitHub - richb-hanover/zoomready at add-dockerfile, then build and run as above… Thanks.

I can’t even build the image, because gcc is missing. I added gcc to the installable packages and ran a bash inside the container. It worked without any error message.

 »  docker run --rm -it  --entrypoint bash localhost/zoomready
root@bb9472409460:/# ping3 1.1.1.1
ping '1.1.1.1' ... 13ms
ping '1.1.1.1' ... 13ms
ping '1.1.1.1' ... 13ms
ping '1.1.1.1' ... 12ms
root@bb9472409460:/# ping3
ping 'example.com' ... 119ms
ping 'example.com' ... 120ms
ping 'example.com' ... 120ms
ping 'example.com' ... 121ms
ping '8.8.8.8' ... 14ms
ping '8.8.8.8' ... 14ms
ping '8.8.8.8' ... 13ms
ping '8.8.8.8' ... 14ms
root@bb9472409460:/#

I also found a note in the README:

### Mac and Linux

There are currently no Linux or Mac versions.

So how do you plan to use it on Mac? Does this statement mean that it can work on MacOS and inside a Linux container but not all features are fully supported?

Hmmm… That’s odd. I don’t know what to say. gcc is not required for this Python program. Are you certain that you’re using the proper Dockerfile?

I verified that I could clone the repo and reproduce the results shown above. (Note the repo had a bug: it now correctly comments out a ping3() call in the Python program.)

As for your second question: The README in the repo talks about the ‘bare Python program’ that has not been customized for either Mac or Linux. That’s why I decided to try to “dockerize” it - I expect that a program in a Docker container should run exactly the same whether it’s hosted on Mac, Windows or Linux.

The GUI (tkinter-based) part works fine - my question is why the ping3() calls fail inside the Docker container.

It was required by pip to install one of the python packages. I don’t remember which one.

I copied your Dockerfile quoted in your second post. I also tried cloning the original github repository and yours as well. The result was the same.

First off, thank you for looking at this question.

Second, I want to emphasize that I’m a newcomer to Docker. I am probably doing something wrong. But I don’t (yet) know what that is.

Further clues: I ran into the same problem/error message on my Ubuntu 20.04 box. I preserved the docker build output (below).

Can you suggest changes to my Dockerfile (or elsewhere)? For example, I’m not wedded to the python:3.8.12-slim base. Many thanks.

richb@ubuntu:~/Documents/git/zoomready$ sudo docker build -t tkinter_in_docker .
Sending build context to Docker daemon    190kB
Step 1/9 : FROM python:3.8.12-slim
3.8.12-slim: Pulling from library/python
5eb5b503b376: Pull complete 
5c69ac0246d0: Pull complete 
cda7900819bb: Pull complete 
bafdd3bd3311: Pull complete 
57bc656e4e02: Pull complete 
Digest: sha256:3f9f66b1b5e35d1075b055865b662eb0bc78fa0e707d9ea7f24a0e7fbc3e0f31
Status: Downloaded newer image for python:3.8.12-slim
 ---> 1eb0130315f6
Step 2/9 : RUN apt-get update -y
 ---> Running in 113aa6354df6
Get:1 http://security.debian.org/debian-security bullseye-security InRelease [44.1 kB]
Get:2 http://deb.debian.org/debian bullseye InRelease [116 kB]
Get:3 http://deb.debian.org/debian bullseye-updates InRelease [39.4 kB]
Get:4 http://security.debian.org/debian-security bullseye-security/main amd64 Packages [121 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 Packages [8183 kB]
Get:6 http://deb.debian.org/debian bullseye-updates/main amd64 Packages [2596 B]
Fetched 8506 kB in 3s (2512 kB/s)
Reading package lists...
Removing intermediate container 113aa6354df6
 ---> c30eccd763e0
Step 3/9 : RUN apt-get install tk -y
 ---> Running in de1bf4ef7c11
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  fontconfig-config fonts-dejavu-core libbrotli1 libbsd0 libdrm-amdgpu1
  libdrm-common libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libedit2
  libelf1 libfontconfig1 libfontenc1 libfreetype6 libgl1 libgl1-mesa-dri
  libglapi-mesa libglvnd0 libglx-mesa0 libglx0 libice6 libllvm11 libmd0
  libpciaccess0 libpng16-16 libsensors-config libsensors5 libsm6 libtcl8.6
  libtk8.6 libutempter0 libvulkan1 libwayland-client0 libx11-6 libx11-data
  libx11-xcb1 libxau6 libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0
  libxcb-present0 libxcb-randr0 libxcb-shape0 libxcb-shm0 libxcb-sync1
  libxcb-xfixes0 libxcb1 libxcomposite1 libxdamage1 libxdmcp6 libxext6
  libxfixes3 libxft2 libxi6 libxinerama1 libxkbfile1 libxmu6 libxmuu1 libxpm4
  libxrandr2 libxrender1 libxshmfence1 libxss1 libxt6 libxtst6 libxv1
  libxxf86dga1 libxxf86vm1 libz3-4 mesa-vulkan-drivers sensible-utils tcl
  tcl8.6 tk8.6 ucf x11-common x11-utils xbitmaps xterm
Suggested packages:
  pciutils lm-sensors tcl-tclreadline mesa-utils xfonts-cyrillic
The following NEW packages will be installed:
  fontconfig-config fonts-dejavu-core libbrotli1 libbsd0 libdrm-amdgpu1
  libdrm-common libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libedit2
  libelf1 libfontconfig1 libfontenc1 libfreetype6 libgl1 libgl1-mesa-dri
  libglapi-mesa libglvnd0 libglx-mesa0 libglx0 libice6 libllvm11 libmd0
  libpciaccess0 libpng16-16 libsensors-config libsensors5 libsm6 libtcl8.6
  libtk8.6 libutempter0 libvulkan1 libwayland-client0 libx11-6 libx11-data
  libx11-xcb1 libxau6 libxaw7 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0
  libxcb-present0 libxcb-randr0 libxcb-shape0 libxcb-shm0 libxcb-sync1
  libxcb-xfixes0 libxcb1 libxcomposite1 libxdamage1 libxdmcp6 libxext6
  libxfixes3 libxft2 libxi6 libxinerama1 libxkbfile1 libxmu6 libxmuu1 libxpm4
  libxrandr2 libxrender1 libxshmfence1 libxss1 libxt6 libxtst6 libxv1
  libxxf86dga1 libxxf86vm1 libz3-4 mesa-vulkan-drivers sensible-utils tcl
  tcl8.6 tk tk8.6 ucf x11-common x11-utils xbitmaps xterm
0 upgraded, 82 newly installed, 0 to remove and 0 not upgraded.
Need to get 49.6 MB of archives.
After this operation, 193 MB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 sensible-utils all 0.0.14 [14.8 kB]
Get:2 http://deb.debian.org/debian bullseye/main amd64 ucf all 3.0043 [74.0 kB]
Get:3 http://deb.debian.org/debian bullseye/main amd64 fonts-dejavu-core all 2.37-2 [1069 kB]
Get:4 http://deb.debian.org/debian bullseye/main amd64 fontconfig-config all 2.13.1-4.2 [281 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 libbrotli1 amd64 1.0.9-2+b2 [279 kB]
Get:6 http://deb.debian.org/debian bullseye/main amd64 libmd0 amd64 1.0.3-3 [28.0 kB]
Get:7 http://deb.debian.org/debian bullseye/main amd64 libbsd0 amd64 0.11.3-1 [108 kB]
Get:8 http://deb.debian.org/debian bullseye/main amd64 libdrm-common all 2.4.104-1 [14.9 kB]
Get:9 http://deb.debian.org/debian bullseye/main amd64 libdrm2 amd64 2.4.104-1 [41.5 kB]

... many lines cut out  ...

Get:78 http://deb.debian.org/debian bullseye/main amd64 libglx0 amd64 1.3.2-1 [35.7 kB]
Get:79 http://deb.debian.org/debian bullseye/main amd64 libgl1 amd64 1.3.2-1 [89.5 kB]
Get:80 http://deb.debian.org/debian bullseye/main amd64 x11-utils amd64 7.7+5 [202 kB]
Get:81 http://deb.debian.org/debian bullseye/main amd64 xbitmaps all 1.1.1-2.1 [25.8 kB]
Get:82 http://deb.debian.org/debian bullseye/main amd64 xterm amd64 366-1 [819 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 49.6 MB in 14s (3535 kB/s)
Selecting previously unselected package sensible-utils.
(Reading database ... 7023 files and directories currently installed.)
Preparing to unpack .../00-sensible-utils_0.0.14_all.deb ...
Unpacking sensible-utils (0.0.14) ...
Selecting previously unselected package ucf.
Preparing to unpack .../01-ucf_3.0043_all.deb ...
Moving old data out of the way
Unpacking ucf (3.0043) ...
Selecting previously unselected package fonts-dejavu-core.
Preparing to unpack .../02-fonts-dejavu-core_2.37-2_all.deb ...
Unpacking fonts-dejavu-core (2.37-2) ...
Selecting previously unselected package fontconfig-config.
Preparing to unpack .../03-fontconfig-config_2.13.1-4.2_all.deb ...
Unpacking fontconfig-config (2.13.1-4.2) ...
Selecting previously unselected package libbrotli1:amd64.
Preparing to unpack .../04-libbrotli1_1.0.9-2+b2_amd64.deb ...
Unpacking libbrotli1:amd64 (1.0.9-2+b2) ...
Selecting previously unselected package libmd0:amd64.
Preparing to unpack .../05-libmd0_1.0.3-3_amd64.deb ...
Unpacking libmd0:amd64 (1.0.3-3) ...
Selecting previously unselected package libbsd0:amd64.
Preparing to unpack .../06-libbsd0_0.11.3-1_amd64.deb ...
Unpacking libbsd0:amd64 (0.11.3-1) ...
Selecting previously unselected package libdrm-common.
Preparing to unpack .../07-libdrm-common_2.4.104-1_all.deb ...
Unpacking libdrm-common (2.4.104-1) ...
Selecting previously unselected package libdrm2:amd64.
Preparing to unpack .../08-libdrm2_2.4.104-1_amd64.deb ...
Unpacking libdrm2:amd64 (2.4.104-1) ...
Selecting previously unselected package libdrm-amdgpu1:amd64.
Preparing to unpack .../09-libdrm-amdgpu1_2.4.104-1_amd64.deb ...
Unpacking libdrm-amdgpu1:amd64 (2.4.104-1) ...
Selecting previously unselected package libpciaccess0:amd64.
Preparing to unpack .../10-libpciaccess0_0.16-1_amd64.deb ...
Unpacking libpciaccess0:amd64 (0.16-1) ...
Selecting previously unselected package libdrm-intel1:amd64.
Preparing to unpack .../11-libdrm-intel1_2.4.104-1_amd64.deb ...
Unpacking libdrm-intel1:amd64 (2.4.104-1) ...
Selecting previously unselected package libdrm-nouveau2:amd64.
Preparing to unpack .../12-libdrm-nouveau2_2.4.104-1_amd64.deb ...
Unpacking libdrm-nouveau2:amd64 (2.4.104-1) ...
Selecting previously unselected package libdrm-radeon1:amd64.
Preparing to unpack .../13-libdrm-radeon1_2.4.104-1_amd64.deb ...
Unpacking libdrm-radeon1:amd64 (2.4.104-1) ...
Selecting previously unselected package libedit2:amd64.
Preparing to unpack .../14-libedit2_3.1-20191231-2+b1_amd64.deb ...
Unpacking libedit2:amd64 (3.1-20191231-2+b1) ...
Selecting previously unselected package libelf1:amd64.
Preparing to unpack .../15-libelf1_0.183-1_amd64.deb ...
Unpacking libelf1:amd64 (0.183-1) ...
Selecting previously unselected package libpng16-16:amd64.
Preparing to unpack .../16-libpng16-16_1.6.37-3_amd64.deb ...
Unpacking libpng16-16:amd64 (1.6.37-3) ...
Selecting previously unselected package libfreetype6:amd64.
Preparing to unpack .../17-libfreetype6_2.10.4+dfsg-1_amd64.deb ...
Unpacking libfreetype6:amd64 (2.10.4+dfsg-1) ...
Selecting previously unselected package libfontconfig1:amd64.
Preparing to unpack .../18-libfontconfig1_2.13.1-4.2_amd64.deb ...
Unpacking libfontconfig1:amd64 (2.13.1-4.2) ...
Selecting previously unselected package libfontenc1:amd64.
Preparing to unpack .../19-libfontenc1_1%3a1.1.4-1_amd64.deb ...
Unpacking libfontenc1:amd64 (1:1.1.4-1) ...
Selecting previously unselected package libglapi-mesa:amd64.
Preparing to unpack .../20-libglapi-mesa_20.3.5-1_amd64.deb ...
Unpacking libglapi-mesa:amd64 (20.3.5-1) ...
Selecting previously unselected package libz3-4:amd64.
Preparing to unpack .../21-libz3-4_4.8.10-1_amd64.deb ...
Unpacking libz3-4:amd64 (4.8.10-1) ...
Selecting previously unselected package libllvm11:amd64.
Preparing to unpack .../22-libllvm11_1%3a11.0.1-2_amd64.deb ...
Unpacking libllvm11:amd64 (1:11.0.1-2) ...
Selecting previously unselected package libsensors-config.
Preparing to unpack .../23-libsensors-config_1%3a3.6.0-7_all.deb ...
Unpacking libsensors-config (1:3.6.0-7) ...
Selecting previously unselected package libsensors5:amd64.
Preparing to unpack .../24-libsensors5_1%3a3.6.0-7_amd64.deb ...
Unpacking libsensors5:amd64 (1:3.6.0-7) ...
Selecting previously unselected package libvulkan1:amd64.
Preparing to unpack .../25-libvulkan1_1.2.162.0-1_amd64.deb ...
Unpacking libvulkan1:amd64 (1.2.162.0-1) ...
Selecting previously unselected package libgl1-mesa-dri:amd64.
Preparing to unpack .../26-libgl1-mesa-dri_20.3.5-1_amd64.deb ...
Unpacking libgl1-mesa-dri:amd64 (20.3.5-1) ...
Selecting previously unselected package libglvnd0:amd64.
Preparing to unpack .../27-libglvnd0_1.3.2-1_amd64.deb ...
Unpacking libglvnd0:amd64 (1.3.2-1) ...
Selecting previously unselected package libxau6:amd64.
Preparing to unpack .../28-libxau6_1%3a1.0.9-1_amd64.deb ...
Unpacking libxau6:amd64 (1:1.0.9-1) ...
Selecting previously unselected package libxdmcp6:amd64.
Preparing to unpack .../29-libxdmcp6_1%3a1.1.2-3_amd64.deb ...
Unpacking libxdmcp6:amd64 (1:1.1.2-3) ...
Selecting previously unselected package libxcb1:amd64.
Preparing to unpack .../30-libxcb1_1.14-3_amd64.deb ...
Unpacking libxcb1:amd64 (1.14-3) ...
Selecting previously unselected package libx11-data.
Preparing to unpack .../31-libx11-data_2%3a1.7.2-1_all.deb ...
Unpacking libx11-data (2:1.7.2-1) ...
Selecting previously unselected package libx11-6:amd64.
Preparing to unpack .../32-libx11-6_2%3a1.7.2-1_amd64.deb ...
Unpacking libx11-6:amd64 (2:1.7.2-1) ...
Selecting previously unselected package libx11-xcb1:amd64.
Preparing to unpack .../33-libx11-xcb1_2%3a1.7.2-1_amd64.deb ...
Unpacking libx11-xcb1:amd64 (2:1.7.2-1) ...
Selecting previously unselected package libxcb-dri2-0:amd64.
Preparing to unpack .../34-libxcb-dri2-0_1.14-3_amd64.deb ...
Unpacking libxcb-dri2-0:amd64 (1.14-3) ...
Selecting previously unselected package libxcb-dri3-0:amd64.
Preparing to unpack .../35-libxcb-dri3-0_1.14-3_amd64.deb ...
Unpacking libxcb-dri3-0:amd64 (1.14-3) ...
Selecting previously unselected package libxcb-glx0:amd64.
Preparing to unpack .../36-libxcb-glx0_1.14-3_amd64.deb ...
Unpacking libxcb-glx0:amd64 (1.14-3) ...
Selecting previously unselected package libxcb-present0:amd64.
Preparing to unpack .../37-libxcb-present0_1.14-3_amd64.deb ...
Unpacking libxcb-present0:amd64 (1.14-3) ...
Selecting previously unselected package libxcb-shm0:amd64.
Preparing to unpack .../38-libxcb-shm0_1.14-3_amd64.deb ...
Unpacking libxcb-shm0:amd64 (1.14-3) ...
Selecting previously unselected package libxcb-sync1:amd64.
Preparing to unpack .../39-libxcb-sync1_1.14-3_amd64.deb ...
Unpacking libxcb-sync1:amd64 (1.14-3) ...
Selecting previously unselected package libxcb-xfixes0:amd64.
Preparing to unpack .../40-libxcb-xfixes0_1.14-3_amd64.deb ...
Unpacking libxcb-xfixes0:amd64 (1.14-3) ...
Selecting previously unselected package libxdamage1:amd64.
Preparing to unpack .../41-libxdamage1_1%3a1.1.5-2_amd64.deb ...
Unpacking libxdamage1:amd64 (1:1.1.5-2) ...
Selecting previously unselected package libxext6:amd64.
Preparing to unpack .../42-libxext6_2%3a1.3.3-1.1_amd64.deb ...
Unpacking libxext6:amd64 (2:1.3.3-1.1) ...
Selecting previously unselected package libxfixes3:amd64.
Preparing to unpack .../43-libxfixes3_1%3a5.0.3-2_amd64.deb ...
Unpacking libxfixes3:amd64 (1:5.0.3-2) ...
Selecting previously unselected package libxshmfence1:amd64.
Preparing to unpack .../44-libxshmfence1_1.3-1_amd64.deb ...
Unpacking libxshmfence1:amd64 (1.3-1) ...
Selecting previously unselected package libxxf86vm1:amd64.
Preparing to unpack .../45-libxxf86vm1_1%3a1.1.4-1+b2_amd64.deb ...
Unpacking libxxf86vm1:amd64 (1:1.1.4-1+b2) ...
Selecting previously unselected package libglx-mesa0:amd64.
Preparing to unpack .../46-libglx-mesa0_20.3.5-1_amd64.deb ...
Unpacking libglx-mesa0:amd64 (20.3.5-1) ...
Selecting previously unselected package x11-common.
Preparing to unpack .../47-x11-common_1%3a7.7+22_all.deb ...
Unpacking x11-common (1:7.7+22) ...
Selecting previously unselected package libice6:amd64.
Preparing to unpack .../48-libice6_2%3a1.0.10-1_amd64.deb ...
Unpacking libice6:amd64 (2:1.0.10-1) ...
Selecting previously unselected package libsm6:amd64.
Preparing to unpack .../49-libsm6_2%3a1.2.3-1_amd64.deb ...
Unpacking libsm6:amd64 (2:1.2.3-1) ...
Selecting previously unselected package libtcl8.6:amd64.
Preparing to unpack .../50-libtcl8.6_8.6.11+dfsg-1_amd64.deb ...
Unpacking libtcl8.6:amd64 (8.6.11+dfsg-1) ...
Selecting previously unselected package libxrender1:amd64.
Preparing to unpack .../51-libxrender1_1%3a0.9.10-1_amd64.deb ...
Unpacking libxrender1:amd64 (1:0.9.10-1) ...
Selecting previously unselected package libxft2:amd64.
Preparing to unpack .../52-libxft2_2.3.2-2_amd64.deb ...
Unpacking libxft2:amd64 (2.3.2-2) ...
Selecting previously unselected package libxss1:amd64.
Preparing to unpack .../53-libxss1_1%3a1.2.3-1_amd64.deb ...
Unpacking libxss1:amd64 (1:1.2.3-1) ...
Selecting previously unselected package libtk8.6:amd64.
Preparing to unpack .../54-libtk8.6_8.6.11-2_amd64.deb ...
Unpacking libtk8.6:amd64 (8.6.11-2) ...
Selecting previously unselected package libutempter0:amd64.
Preparing to unpack .../55-libutempter0_1.2.1-2_amd64.deb ...
Unpacking libutempter0:amd64 (1.2.1-2) ...
Selecting previously unselected package libwayland-client0:amd64.
Preparing to unpack .../56-libwayland-client0_1.18.0-2~exp1.1_amd64.deb ...
Unpacking libwayland-client0:amd64 (1.18.0-2~exp1.1) ...
Selecting previously unselected package libxt6:amd64.
Preparing to unpack .../57-libxt6_1%3a1.2.0-1_amd64.deb ...
Unpacking libxt6:amd64 (1:1.2.0-1) ...
Selecting previously unselected package libxmu6:amd64.
Preparing to unpack .../58-libxmu6_2%3a1.1.2-2+b3_amd64.deb ...
Unpacking libxmu6:amd64 (2:1.1.2-2+b3) ...
Selecting previously unselected package libxpm4:amd64.
Preparing to unpack .../59-libxpm4_1%3a3.5.12-1_amd64.deb ...
Unpacking libxpm4:amd64 (1:3.5.12-1) ...
Selecting previously unselected package libxaw7:amd64.
Preparing to unpack .../60-libxaw7_2%3a1.0.13-1.1_amd64.deb ...
Unpacking libxaw7:amd64 (2:1.0.13-1.1) ...
Selecting previously unselected package libxcb-randr0:amd64.
Preparing to unpack .../61-libxcb-randr0_1.14-3_amd64.deb ...
Unpacking libxcb-randr0:amd64 (1.14-3) ...
Selecting previously unselected package libxcb-shape0:amd64.
Preparing to unpack .../62-libxcb-shape0_1.14-3_amd64.deb ...
Unpacking libxcb-shape0:amd64 (1.14-3) ...
Selecting previously unselected package libxcomposite1:amd64.
Preparing to unpack .../63-libxcomposite1_1%3a0.4.5-1_amd64.deb ...
Unpacking libxcomposite1:amd64 (1:0.4.5-1) ...
Selecting previously unselected package libxi6:amd64.
Preparing to unpack .../64-libxi6_2%3a1.7.10-1_amd64.deb ...
Unpacking libxi6:amd64 (2:1.7.10-1) ...
Selecting previously unselected package libxinerama1:amd64.
Preparing to unpack .../65-libxinerama1_2%3a1.1.4-2_amd64.deb ...
Unpacking libxinerama1:amd64 (2:1.1.4-2) ...
Selecting previously unselected package libxkbfile1:amd64.
Preparing to unpack .../66-libxkbfile1_1%3a1.1.0-1_amd64.deb ...
Unpacking libxkbfile1:amd64 (1:1.1.0-1) ...
Selecting previously unselected package libxmuu1:amd64.
Preparing to unpack .../67-libxmuu1_2%3a1.1.2-2+b3_amd64.deb ...
Unpacking libxmuu1:amd64 (2:1.1.2-2+b3) ...
Selecting previously unselected package libxrandr2:amd64.
Preparing to unpack .../68-libxrandr2_2%3a1.5.1-1_amd64.deb ...
Unpacking libxrandr2:amd64 (2:1.5.1-1) ...
Selecting previously unselected package libxtst6:amd64.
Preparing to unpack .../69-libxtst6_2%3a1.2.3-1_amd64.deb ...
Unpacking libxtst6:amd64 (2:1.2.3-1) ...
Selecting previously unselected package libxv1:amd64.
Preparing to unpack .../70-libxv1_2%3a1.0.11-1_amd64.deb ...
Unpacking libxv1:amd64 (2:1.0.11-1) ...
Selecting previously unselected package libxxf86dga1:amd64.
Preparing to unpack .../71-libxxf86dga1_2%3a1.1.4-1+b3_amd64.deb ...
Unpacking libxxf86dga1:amd64 (2:1.1.4-1+b3) ...
Selecting previously unselected package mesa-vulkan-drivers:amd64.
Preparing to unpack .../72-mesa-vulkan-drivers_20.3.5-1_amd64.deb ...
Unpacking mesa-vulkan-drivers:amd64 (20.3.5-1) ...
Selecting previously unselected package tcl8.6.
Preparing to unpack .../73-tcl8.6_8.6.11+dfsg-1_amd64.deb ...
Unpacking tcl8.6 (8.6.11+dfsg-1) ...
Selecting previously unselected package tcl.
Preparing to unpack .../74-tcl_8.6.11+1_amd64.deb ...
Unpacking tcl (8.6.11+1) ...
Selecting previously unselected package tk8.6.
Preparing to unpack .../75-tk8.6_8.6.11-2_amd64.deb ...
Unpacking tk8.6 (8.6.11-2) ...
Selecting previously unselected package tk.
Preparing to unpack .../76-tk_8.6.11+1_amd64.deb ...
Unpacking tk (8.6.11+1) ...
Selecting previously unselected package libglx0:amd64.
Preparing to unpack .../77-libglx0_1.3.2-1_amd64.deb ...
Unpacking libglx0:amd64 (1.3.2-1) ...
Selecting previously unselected package libgl1:amd64.
Preparing to unpack .../78-libgl1_1.3.2-1_amd64.deb ...
Unpacking libgl1:amd64 (1.3.2-1) ...
Selecting previously unselected package x11-utils.
Preparing to unpack .../79-x11-utils_7.7+5_amd64.deb ...
Unpacking x11-utils (7.7+5) ...
Selecting previously unselected package xbitmaps.
Preparing to unpack .../80-xbitmaps_1.1.1-2.1_all.deb ...
Unpacking xbitmaps (1.1.1-2.1) ...
Selecting previously unselected package xterm.
Preparing to unpack .../81-xterm_366-1_amd64.deb ...
Unpacking xterm (366-1) ...
Setting up libpciaccess0:amd64 (0.16-1) ...
Setting up libxau6:amd64 (1:1.0.9-1) ...
Setting up libglvnd0:amd64 (1.3.2-1) ...
Setting up libbrotli1:amd64 (1.0.9-2+b2) ...
Setting up x11-common (1:7.7+22) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
Setting up libsensors-config (1:3.6.0-7) ...
Setting up libfontenc1:amd64 (1:1.1.4-1) ...
Setting up libz3-4:amd64 (4.8.10-1) ...
Setting up libx11-data (2:1.7.2-1) ...
Setting up libpng16-16:amd64 (1.6.37-3) ...
Setting up libtcl8.6:amd64 (8.6.11+dfsg-1) ...
Setting up fonts-dejavu-core (2.37-2) ...
Setting up libsensors5:amd64 (1:3.6.0-7) ...
Setting up libglapi-mesa:amd64 (20.3.5-1) ...
Setting up libvulkan1:amd64 (1.2.162.0-1) ...
Setting up libutempter0:amd64 (1.2.1-2) ...
Setting up libmd0:amd64 (1.0.3-3) ...
Setting up sensible-utils (0.0.14) ...
Setting up libxshmfence1:amd64 (1.3-1) ...
Setting up libbsd0:amd64 (0.11.3-1) ...
Setting up libdrm-common (2.4.104-1) ...
Setting up libelf1:amd64 (0.183-1) ...
Setting up xbitmaps (1.1.1-2.1) ...
Setting up libwayland-client0:amd64 (1.18.0-2~exp1.1) ...
Setting up libice6:amd64 (2:1.0.10-1) ...
Setting up libxdmcp6:amd64 (1:1.1.2-3) ...
Setting up tcl8.6 (8.6.11+dfsg-1) ...
Setting up libxcb1:amd64 (1.14-3) ...
Setting up libxcb-xfixes0:amd64 (1.14-3) ...
Setting up libxcb-glx0:amd64 (1.14-3) ...
Setting up libedit2:amd64 (3.1-20191231-2+b1) ...
Setting up libxcb-shape0:amd64 (1.14-3) ...
Setting up libxcb-shm0:amd64 (1.14-3) ...
Setting up libxcb-present0:amd64 (1.14-3) ...
Setting up libllvm11:amd64 (1:11.0.1-2) ...
Setting up libfreetype6:amd64 (2.10.4+dfsg-1) ...
Setting up libxcb-sync1:amd64 (1.14-3) ...
Setting up ucf (3.0043) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up libxcb-dri2-0:amd64 (1.14-3) ...
Setting up libdrm2:amd64 (2.4.104-1) ...
Setting up libxcb-randr0:amd64 (1.14-3) ...
Setting up tcl (8.6.11+1) ...
Setting up libx11-6:amd64 (2:1.7.2-1) ...
Setting up libxkbfile1:amd64 (1:1.1.0-1) ...
Setting up libxcomposite1:amd64 (1:0.4.5-1) ...
Setting up libsm6:amd64 (2:1.2.3-1) ...
Setting up libxmuu1:amd64 (2:1.1.2-2+b3) ...
Setting up libdrm-amdgpu1:amd64 (2.4.104-1) ...
Setting up libxcb-dri3-0:amd64 (1.14-3) ...
Setting up libx11-xcb1:amd64 (2:1.7.2-1) ...
Setting up libdrm-nouveau2:amd64 (2.4.104-1) ...
Setting up libxdamage1:amd64 (1:1.1.5-2) ...
Setting up libxpm4:amd64 (1:3.5.12-1) ...
Setting up libxrender1:amd64 (1:0.9.10-1) ...
Setting up libdrm-radeon1:amd64 (2.4.104-1) ...
Setting up fontconfig-config (2.13.1-4.2) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/x86_64-linux-gnu/perl5/5.32 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl-base /usr/lib/x86_64-linux-gnu/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype
Setting up libdrm-intel1:amd64 (2.4.104-1) ...
Setting up libgl1-mesa-dri:amd64 (20.3.5-1) ...
Setting up libxext6:amd64 (2:1.3.3-1.1) ...
Setting up libxxf86vm1:amd64 (1:1.1.4-1+b2) ...
Setting up libxfixes3:amd64 (1:5.0.3-2) ...
Setting up libxinerama1:amd64 (2:1.1.4-2) ...
Setting up libxv1:amd64 (2:1.0.11-1) ...
Setting up libxrandr2:amd64 (2:1.5.1-1) ...
Setting up libxt6:amd64 (1:1.2.0-1) ...
Setting up libxss1:amd64 (1:1.2.3-1) ...
Setting up libfontconfig1:amd64 (2.13.1-4.2) ...
Setting up mesa-vulkan-drivers:amd64 (20.3.5-1) ...
Setting up libxft2:amd64 (2.3.2-2) ...
Setting up libxmu6:amd64 (2:1.1.2-2+b3) ...
Setting up libglx-mesa0:amd64 (20.3.5-1) ...
Setting up libxi6:amd64 (2:1.7.10-1) ...
Setting up libglx0:amd64 (1.3.2-1) ...
Setting up libxtst6:amd64 (2:1.2.3-1) ...
Setting up libtk8.6:amd64 (8.6.11-2) ...
Setting up libxxf86dga1:amd64 (2:1.1.4-1+b3) ...
Setting up libxaw7:amd64 (2:1.0.13-1.1) ...
Setting up libgl1:amd64 (1.3.2-1) ...
Setting up x11-utils (7.7+5) ...
Setting up xterm (366-1) ...
update-alternatives: using /usr/bin/xterm to provide /usr/bin/x-terminal-emulator (x-terminal-emulator) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/x-terminal-emulator.1.gz because associated file /usr/share/man/man1/xterm.1.gz (of link group x-terminal-emulator) doesn't exist
update-alternatives: using /usr/bin/lxterm to provide /usr/bin/x-terminal-emulator (x-terminal-emulator) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/x-terminal-emulator.1.gz because associated file /usr/share/man/man1/lxterm.1.gz (of link group x-terminal-emulator) doesn't exist
Setting up tk8.6 (8.6.11-2) ...
Setting up tk (8.6.11+1) ...
Processing triggers for libc-bin (2.31-13+deb11u2) ...
Removing intermediate container de1bf4ef7c11
 ---> d70f80091d62
Step 4/9 : RUN pip install --no-cache-dir -U numpy
 ---> Running in 437352a9fccb
Collecting numpy
  Downloading numpy-1.22.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.8 MB)
Installing collected packages: numpy
Successfully installed numpy-1.22.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 21.2.4; however, version 22.0.3 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
Removing intermediate container 437352a9fccb
 ---> 413873c8e008
Step 5/9 : RUN pip install --no-cache-dir -U psutil
 ---> Running in ddad2c5ce194
Collecting psutil
  Downloading psutil-5.9.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (283 kB)
Installing collected packages: psutil
Successfully installed psutil-5.9.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 21.2.4; however, version 22.0.3 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
Removing intermediate container ddad2c5ce194
 ---> ace559562965
Step 6/9 : RUN pip install --no-cache-dir -U ping3
 ---> Running in 01dafb44127f
Collecting ping3
  Downloading ping3-3.0.2-py3-none-any.whl (12 kB)
Installing collected packages: ping3
Successfully installed ping3-3.0.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 21.2.4; however, version 22.0.3 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
Removing intermediate container 01dafb44127f
 ---> c4e0f92b141b
Step 7/9 : RUN pip install --no-cache-dir -U cloudflarepycli
 ---> Running in 4c3cea2461c6
Collecting cloudflarepycli
  Downloading cloudflarepycli-1.6.0-py3-none-any.whl (7.0 kB)
Collecting requests
  Downloading requests-2.27.1-py2.py3-none-any.whl (63 kB)
Collecting bs4
  Downloading bs4-0.0.1.tar.gz (1.1 kB)
Collecting wres
  Downloading wres-1.0.3-py2.py3-none-any.whl (5.9 kB)
Requirement already satisfied: numpy in /usr/local/lib/python3.8/site-packages (from cloudflarepycli) (1.22.2)
Collecting beautifulsoup4
  Downloading beautifulsoup4-4.10.0-py3-none-any.whl (97 kB)
Collecting soupsieve>1.2
  Downloading soupsieve-2.3.1-py3-none-any.whl (37 kB)
Collecting charset-normalizer~=2.0.0
  Downloading charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Collecting idna<4,>=2.5
  Downloading idna-3.3-py3-none-any.whl (61 kB)
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.8-py2.py3-none-any.whl (138 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Building wheels for collected packages: bs4
  Building wheel for bs4 (setup.py): started
  Building wheel for bs4 (setup.py): finished with status 'done'
  Created wheel for bs4: filename=bs4-0.0.1-py3-none-any.whl size=1272 sha256=b0f22a6b36d8a69252851dba3dd0c90d1ff01f7a992380b568dd4a0e94126f52
  Stored in directory: /tmp/pip-ephem-wheel-cache-0fx5sjwi/wheels/75/78/21/68b124549c9bdc94f822c02fb9aa3578a669843f9767776bca
Successfully built bs4
Installing collected packages: soupsieve, urllib3, idna, charset-normalizer, certifi, beautifulsoup4, wres, requests, bs4, cloudflarepycli
Successfully installed beautifulsoup4-4.10.0 bs4-0.0.1 certifi-2021.10.8 charset-normalizer-2.0.12 cloudflarepycli-1.6.0 idna-3.3 requests-2.27.1 soupsieve-2.3.1 urllib3-1.26.8 wres-1.0.3
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 21.2.4; however, version 22.0.3 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
Removing intermediate container 4c3cea2461c6
 ---> 9999c1583d23
Step 8/9 : CMD ["/src/zoomsimple.py"]
 ---> Running in e911cd2b1f06
Removing intermediate container e911cd2b1f06
 ---> f0c55b431762
Step 9/9 : ENTRYPOINT ["python3"]
 ---> Running in 549a350a96ed
Removing intermediate container 549a350a96ed
 ---> 64da002f3470
Successfully built 64da002f3470
Successfully tagged tkinter_in_docker:latest

Have you tried ping3 on your Ubuntu host? Sorry if you have already written it in one of your previous posts, I just write this post quickly.

OK. I am smarter than I was this morning…

I switched to root user using docker exec -u 0 -it whatever-docker-name /bin/bash

That allowed me to execute the ping3 1.1.1.1 command without the Permission Error. (I was also able to apt install iputils-ping and issue the standard ping command.)

I think I have enough to go on: I will try running the Python program with sudo so that it has permission to invoke ping3

I’ll post my updated Dockerfile when I am done. Thanks.

I haven’t figured this out (running ping3 as root) - I ran out of time for the moment because this is a side project. But I re-framed the question on a new topic (since it’s not a macOS problem.)

The new topic is at: Run a subprogram of a Python program as root? I’d love to get answers here or over there. Thanks again.