Should be just a question of changing these two env var values, like I'm doing here:
HOST_PORT=7664
IPADDRESS=192.168.1.101:7664
Don't change anything in the Docker compose.
Should be just a question of changing these two env var values, like I'm doing here:
HOST_PORT=7664
IPADDRESS=192.168.1.101:7664
Don't change anything in the Docker compose.
Apparrently it is all me... 
I recopied the docker compose over to a new test one so I could run everything at once... left the compose alone again. adjusted environment variables host, ipaddress, tuner number down to one and pointed tuner at extra appletv and booted up.
It complained about the version 3.9 at the top last time and first time here even though my normal one works fine with it...then the next time I hit deploy with it still there it went right through and started.
Thanks again I will just blame my fat fingers and poor eyes. 
You'll only see the warning about using Version (it's been deprecated), when there's an actual error elsewhere. Ignore the warning, and look further down in the message for the true error.
Thank you very much for your insight! I went down a long stray path but am much further along...
When I initially deployed the AH4C container, I tried running some pyatv commands (like checking the version) inside the container to confirm everything was working, but got errors — for example, python3 -m pyatv --version failed with a “not directly executable” error.
Turns out that was just a misunderstanding of how pyatv is structured. The correct way to run commands is to use atvremote, which is the actual CLI frontend for pyatv. Once I switched to using atvremote, everything worked — I could run version checks and attempt control commands.
So it wasn’t a container issue — just a misuse of the wrong entry point
Once I saw the working ah4c webUI at port 7654 on my host browser as pointed out by @ChannelSam , things started to make sense
Thank you for all this. I am very much further along. Ive deployed the stack and see the ah4c web UI. I can also run some of the atvremote commands from the console, so all my questions about the TAG have been answered.
Now Im hitting a bit of a roadblock and wanted to jog your memory , (perhaps @bnhf @Fofer and/or others can chime in as well ) with what you are doing for your spectrum implementation. Are you running your docker on a MAC, a Windows PC or linux machine? I thought I remember you mentioning you use a MAC for this, but it may have been someone else.
Ive been using CHatGPt to try and work through this and it is pointing me to the following:
The root issue appears to be that Docker on macOS doesn’t use host networking and instead creates an isolated VM network (usually 192.168.65.0/24). Because of this, the container can’t fully communicate with LAN devices like the Apple TV over protocols like Companion or MRP, which rely on mDNS and direct LAN access.
Even with the container able to ping the Apple TV’s IP, pyatv inside Docker can’t detect or pair with it properly. This seems to break remote key commands, app switching, and pairing — though ping and basic IP reachability work
There are workarounds, but it would mean Id have to call all my cox tuning scripts using pyatv outside the docker. I had already developed a standalone environment and have a tuning script and force_quit script which run outside of docker. I was hoping to keep everything running inside of docker so I could take your scripts @ChannelSam and model all the logic that ties everything together with the ah4c logic , the M3Us, etc.
And of course also keep everything as portable as possible within a docker container. Im Alsop new to docker and portainer, just a few weeks into this project. It is quite possible that ChatGPT has led me on another stray path and there is a simple fix.
Ive been wracking my brain all day testing different ways to have the atvremote inside docker be able to see my local LAN IP addresses. I even tried using my tailnet as a workaround, My host and the Apple TV tuner are both on my tailnet anyway, so I was hoping using my tailnet IPs could work - to no avail.
Does anyone have atvremote commands controlling an Apple TV from within the docker on a MAC. I have an apple M4 Mac mini. I know @Fofer uses an apple silicon Mac @Fofer have you ever tried running pyatv within a docker container on your Mac mini?
Any insight would be appreciated, and thanks in advance to all
What version of Docker Desktop are you running?
See PSA: Running Channels DVR in Docker Desktop for Mac/Windows/Linux using HOST network mode
I can't help with the mac issues...running linux server here...
I will say use the COMPLETE paths for your commands in your scripts I could run atvremote commands directly in the docker ah4c container console...BUT if I put the same command in a script I had issues (don't remember all the details anymore).
Example atvremote command in script:
/usr/local/bin/atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP home
Im using : docker desktop 4.42.1 (196648)
I saw the PSA you linked and got very excited. There is an option to select enable host networking. However, according to CHatGPT, when I asked it
On the docker desktop dashboard under resources\network there is a radio button to "enable host networking". would that work?
ChatGPT replied..
Unfortunately no, not on macOS. Here’s the key reason:
macOS does not support true host networking in Docker
Even though Docker Desktop for Mac shows a checkbox for “Enable host networking,” it’s only effective on Linux. On macOS, this option is ignored, and host networking is silently disabled due to how Docker runs using a lightweight Linux VM under the hood (via qemu or virtiofs).
So:
Workaround Options
To work around this on macOS:
Let me know which direction you’d prefer — especially if keeping Docker portable is still a priority.
Im still going to try this anyway, perhaps ChatGPT has developed an ego, and is locked to its opinion.....

@mnwxman132 I'm pretty certain host networking is not required. Though I've never used ah4c:pyatv in production, I did test it a number of times using an AppleTV on my network with standard bridge networking.
If you look at the pairing script @ChannelSam used, and his Docker Compose, you'll see he's not using host networking either:
The command both of us used to pair devices is shown in the script as a comment.
His Docker Compose:
Note that host mode is not in use.
Just wanted to poke in and report back to you both. I have a proof of concept working tuner for the cox contour app with some hardcoded logic up and running end to end with channels.
Some early observations are that
1: Olivetin is freakin awesome. The "find grace note IDs" has already payed huge dividends. Cant thank you enough for all you do @bnhf
2: The manual pairing and tuning using mimicked button keypress works, but is highly dependent on each individual apps like spectrum, or cox, or some others individual UI. With spectrum, it looks like you are using streamlink —edit I meant deep links- @ChannelSam , so the tuning is quick
3: For those go us using
atvremote --storage-filename /root/.android/.pyatv.conf -s 10.10.11.42 up
atvremote --storage-filename /root/.android/.pyatv.conf -s 10.10.11.42 down
type commands the tuning is slow and inefficient, and at times can be limiting if future expansion is needed.
3: Ive already tested a simple python script that can allow alphanumeric entry for tuning to reduce the slow key press wait times. This will allow for future expansion and quicker channel tuning and flipping live.
4: As I integrate this more and fine tune the scripts, it may be possible to make a stable "generalized Apple TV tuning model" for ANY app that is installed. Im jumping ahead of myself, but I could see it happen. It would be a series of Python and ah4c scripts combined. Have to think this through more,
My new shorter term goal is to write stable python bmitune, prebmitune (if needed) and stopbmitune Iiff needed) scripts. that can call the more advanced alphanumeric entries for channel tuning using the cox search bar. This will be my next proof of concept phase. Im currently moving logic blocks around where the more advance calls are made.
Thanks to you both and have a great 4th. I need a break. ChatGPT does have an ego, and a short memory as well.
Thanks for the update.
I am not sure if you are aware of some of this or not so I will take a mention it.
The links I am using to "tune" the channels on ATV4k are called deeplinks...This is the same thing that ADBTuner uses to tune channels on android devices if that device supports adb debugging and the particular app supports deeplinks.
What I posted was my beginning script for tuning because I am trying to do some different things that complicate the script for no reason. With a few changes using "Case" in your scripts you can have different commands that could tell bmitune to use a specific tuner for that channel, use specific commands only for some channels. The current ATV version of ah4c doesn't support android adb so you would have to spin those up on a second instance with android support. If you look at the firetv scripts installed automatically you can see an example of using "Case"
If you haven't investigated whether Cox has deeplinks you can use a few things to give you clues.
If you are looking at the Cox app and watching a channel on a computer, phone or tablet does it allow you to "cast it" directly to your tv/appletv/android tv.
Another way to know is if the Cox app intergrates with the ATV main menu, tv providers. If you see menu items at the top showing what is currently on cox tv channels allowing you to click on them AND go directly to that channel THAT is a deeplink.
Where it gets extra complicated is that they may support deeplinks on some devices and not on others. One example of this is Spectrum...It supports deeplinks on ATVs but NOT on Roku devices (Rokus were going to be my original low cost solution to tune spectrum channels). And spectrum is not available at all on Firetv or Android devices (I assume because they can't agree who deserves to get more money from their customers. lol)
Do some searching about deeplinks on the forum where it talks about finding them.
You don't need separate entries for each command in atvremote it supports multiple commands and delays separated by spaces.
Example:
/usr/local/bin/atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP up up up delay=2000 left left delay=1000 select
Good Luck, Keep us informed.
Thanks. I’ll research further. I think I said something about streamlinks in my last post, but I meant deep links.
I spent a lot of time when I first got my linkPi playing with an android firestick and also an onn device. As well as the iPhone cox contour app, and diving into its apk file for deeplinks. Then later also chrome capture. I ran into many many different authorization issues of different manifestations on different approaches and tuner platforms Between NBC affiliates and COX it just made more sense to use the native contour app on the ATV in my case. Very very stable with no authorization hiccups for many months now.
But thanks for the tips. I’ll investigate adding the multiple commands in each case. Perhaps when my head is back in it next week I may poke you again if you don’t mind for and example syntax if I can’t figure it out with ChatGPT. And I’m gonna revisit the deep link search on the ATV the way you suggested.
Thanks for sharing and supporting me and others!!
I’m gonna eventually summarize all my pitfalls that a I ran into in a new preface to this thead, so others can benefit and build their own stuff too. Just need a break for now.
Thank you for paying it forward. Appreciate it. I’ll do the same
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
@ChannelSam I was just adding your scripts/atv/spectrum files to the repo, and I noticed you didn't include prebmitune.sh. Could you post that one too please?
@bnhf I just poked around in my development environment to take a look at my scripts. The docker compose and env are very straight forward based on your templates. I have a bunch of python scripts that are running in my tuner container that are called from bmitune and stopbmitune. I created an alphanumeric tuner, that works on the appletv that could potentially work in other applications that dont support deeplinks. The alphanumeric approach is relatively fast and much more flexible instead of mimicking remote control pad keypresses - depending on the situation. However, right now it is hardcoded strictly for the cox application, and it works as long as the application is in the correct search menu. Thats where an OCR or other watchdog might make sense. And to preserve decent tuning times it may or may not make sense to have this watchdog running all the time in a separate container that can be called by all the various tuners in multiple stacks. I need to take some time to think about this all further.
In the meantime thinking slightly ahead, how would you like me to post these scripts once there a little more cleaned up for others to use?
I could post here on this thread, or post them on GitHub or we could direct message? At the moment, these are not ready for prime time, but very workable here for me - If that makes sense. There would be a mix of shell scripts and python scripts etc
What would you think about PM'ing me the scripts as they are now (which I won't share), so I can see what we're talking about -- and how things might work as far as including them in the container.
To date the scripts have always been in bash, so there may be a few new things to consider on my end.
Ultimately the idea would be to add them to the ah4c repo, just in case anyone wants to build from source.
I don't run any prebmitune.sh code.
It is just a script with no run instructions...
premitune.sh
#!/bin/bash
# Nothing needed in this file!
It needs to be included though; ah4c doesn't work without its scripts, even if they're "no op".