"container_links" seams to have no effect

I’m writing a rockon for Tiny-Tiny-RSS (https://tt-rss.org/gitlab/fox/tt-rss/wikis/home) consisting of a clue/ttrss and a postgres container. I trying to link them using the “container_links” object which is undocumented but used in the ownlcoud and rocket chat rockons. The rockon installs fine but does not start. When i start in manually via ssh using “docker start -i ttrss-test” i get the following message: Error: The env DB_PORT does not exist. Make sure to run with “–link mypostgresinstance:DB”.

When i instead of “container_links” use the “opts” object inside the ttrss container with [ “–link” “ttrss_postgres-test:db” ] everything works fine.

Heres my rockon:

{
"TinyTinyRSS Test": {
    "container_links": {
        "ttrss-test": [
            {
                "name": "db",
                "source_container": "ttrss_postgres-test"
            }
        ]
    },
    "containers": {
        "ttrss-test": {
            "image": "clue/ttrss",
	        "tag": "latest",
            "launch_order": 2,
            "ports": {
                "80": {
                    "description": "Tiny-Tiny-RSS WebUI port. Suggested default: 8888",
                    "host_default": 8286,
                    "label": "WebUI port",
                    "protocol": "tcp",
                    "ui": true
                }
            }
            
        },
        "ttrss_postgres-test": {
            "image": "postgres",
	        "tag": "latest",
            "launch_order": 1,
            "volumes": {
                "/var/lib/posgresql/data/pgdata": {
                    "description": "Choose a Share for the PosgreSQL database of Tiny-Tiny-Rss.",
                    "label": "Database Storage",
                    "min_size": 1073741824
                }
            },
            "opts":[
                ["-e","PGDATA=/var/lib/posgresql/data/pgdata"],
                ["-e","POSTGRES_USER=ttrss"]
            ]
        }
    },
    "version": "latest stable",
    "description": "Web-based news feed reader and aggregator",
    "icon": "https://tt-rss.org/gitlab/uploads/project/avatar/1/ic_launcher.png",
    "more_info": "<p>The default user credentials are admin/password. Make sure to change them after your first login.</p>",
    "ui": {
        "https": true,
        "slug": ""
    },
    "website": "https://tt-rss.org/"
}

}

Do you really need them? Why not just open the port for the postgres and call it from the other container? Docker networking kind of made the feature you’re referring to obsolete I thought? https://docs.docker.com/engine/userguide/networking/default_network/dockerlinks/

1 Like

Linking to a postgres container is the suggested way for running the ttrss container (https://github.com/clue/docker-ttrss). Also, this way the dependencies are expressed much more explicitly.

What you are saying is that by default all containers can connect to all ports of all other containers in rockstor? I find that quite insecure given that a lot of containers use weak passwords e.g. for databases because they think docker protects them. I would rather like to have the --icc flag set to false (https://docs.docker.com/engine/userguide/networking/default_network/container-communication/#communicating-between-containers) In this case linking would be required for the containers to communicate. Another option would be to set up a separate docker network for each rock-on.

You’re quoting a project that hasn’t been updated in 2-3 years. Linking is legacy, not sure what else to tell you here (this is from Docker, not from my opinion). As for security, there are many ways to secure something. You’re generally only mapping the port you need to access externally. you can further secure the port via firewall rules, postgres options or even selinux. You don’t need to link to have things work.

Now, as for the the original topic, I don’t know why the linked containers don’t work at the moment, but if you want to get this container working, I’d suggest forking and modifying it so you don’t need to link and the problem is solved. If not, your issue is likely that you’re not passing the DB_PORT environment variable. Try adding the following line after POSTGRES_USER
["-e",“DB_PORT=5432”]
to see if that works.