需要帮助 dockerize apt-cacher-ng 服务

Need help dockerize an apt-cacher-ng service

我正在关注

Docker 化 apt-cacher-ng 服务
https://docs.docker.com/engine/examples/apt-cacher-ng/

但没能成功 运行。

我已成功关注

To see the logfiles that are tailed in the default command, you can use:

$ docker logs -f test_apt_cacher_ng

然后我得到

$ docker logs -f test_apt_cacher_ng
WARNING: No configuration was read from file:sfnet_mirrors
Starting apt-cacher-ng: apt-cacher-ng.

但我只能到此为止,不能再进一步了。 我认为我的步骤:

$ docker run -d -p 3142:3142 --name test_apt_cacher_ng eg_apt_cacher_ng

在端口 3142 没有给我一个 apt_cacher_ng,因为:

$ ip a s | grep 'docker0$'
    inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0

$ nc -z 172.17.0.1 3142 | wc        
      0       0       0

$ lsof -i :3142 | wc
      0       0       0

我还可以检查什么来确保我有一个 dockerized apt-cacher-ng 服务,它也已经启动并且 运行?

网络更复杂,因为容器 运行 在自己的网络命名空间中。查看收听:

$ netstat -tanp  | grep 3142
tcp        0      0 172.17.0.1:39182        172.17.0.1:3142         TIME_WAIT   -
tcp6       0      0 :::3142                 :::*                    LISTEN      46336/docker-proxy

最好的选择是从主机 OS(apt-cacher-ng 在端口 3142 上的所有接口上公开)使用 curl:

检查
$ curl http://127.0.0.1:3142
<!DOCTYPE html>
<html lang="en">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <meta http-equiv="X-UA-Compatible" content="IE=8" />
      <meta name="MSSmartTagsPreventParsing" content="true" />
      <title>Not Found or APT Reconfiguration required</title>
      <link rel="stylesheet" type="text/css" href="/style.css" />
   </head>
...