How to scan using SANE from docker container? - docker

I have an old wifi printer/scanner HP Photosmart B209a. I can print and scan from the host machine, but I would like to print and scan from the Docker container.
Printing is working: the image has CUPS installed, I copy /etc/cups/printers.conf from host machine, start cupsd - and viola, printing is fine.
But I don't know how to configure SANE to find the scanner. Where is SANE config located? Which files should I copy from the host machine? Are there any limitations which would prevent my scanner from working from the container?

Related

Gitlab Runner, docker executor, deploy from linux container to CIFS share

I have a Gitlab runner that runs all kind of jobs using Docker executors (host is Ubuntu 20, guests are various Linux images). The runner runs containers as unprivileged.
I am stumped on an apparently simple requirement - I need to deploy some artifacts on a Windows machine that exposes the target path as an authenticated share (\\myserver\myapp). Nothing more than replacing files on the target with the ones on the source - a simple rsync would be fine.
Gitlab Runner does not allow specifying mounts in the CI config (see https://gitlab.com/gitlab-org/gitlab-runner/-/issues/28121), so I tried using mount.cifs, but I discovered that by default Docker does not allow mounting anything inside the container unless running privileged, which I would like to avoid.
I also tried the suggestion to use --cap-add as described at Mount SMB/CIFS share within a Docker container but they do not seem to be enough for my host, there are probably other required capabilities and I have no idea how to identify them. Also, this looks just slightly less ugly than running privileged.
Now, I do not strictly need to mount the remote folder - if there were an SMB-aware rsync command for example I would be more than happy to use that. Unfortunately I cannot install anything on the Windows machine (no SSH, no SCP, no FTP).
Do you have any idea on how achieve this?
Unfortunately I cannot install anything on the Windows machine (no SSH, no SCP, no FTP).
You could simply copy an executable (that you can build anywhere else) in Go, listening to a port, ready to receive a file.
This this implementation for instance: file-receive.go. It listens on port 8080 (can be changed) and copies the file content to a local folder.
No installation or setup required: just copy the exe to the target machine and run it.
From your GitLab runner, you can 'curl' send a file to the remote PC machine, port 8080.

Develop on Docker container from Intellij

How can develop on my Docker container from Intellij? I am developing on macOS, but my development environment is inside a Docker container. In VSCode, I can use the Remote - Containers extension to open the files in my Docker container, go to function definitions, use the version of Go on the container, access the container shell--it's as if I am accessing a remote machine from VSCode. I didn't have to change my Dockerfile or mount any volumes. Everything just worked.
IntelliJ seems to have added something according to this, but the total functionality is unclear. I can attach to a running container using the Docker plugin, access the shell, and inspect the container's attributes, but none of the above other functionality with VSCode.
Here are some examples of why this is needed:
I am developing on macOS, but my target is specific to Intel Linux code. If I do Cmd+B on a symbol, I'm taken to a Darwin specific file
importing github.com/docker/libnetwork fails because the files in this package can only be built for Linux
The above doesn't happen on VSCode because I can develop directly on the container.

VSCode in-container-debugging over SSH machine

I am trying to setup and advanced configuration with VScode insider and I ma facing an issue.
My setup is:
VSCode Running in my local machine Windows 10 with a Django source code hosted on my machine. I have no docker client on this machine, and I don't wont to install one...
A virtual machine with Ubuntu is running a docker daemon, docker client and docker-compose. My workspace is shared over vboxfs and mounted on my Ubuntu
A python docker container is running in the Ubuntu machine and running the mounted code.
I tried to use the Remote Extension to debug the python code inside the container. However, when a run my vscode inside on the remote SSH Taget (so the ubuntu machine), I am able to manage docker objects (images, containers, etc...) using the Docker extension of vscode, but I can't see the option: Remote-Containers: Open Folder in Container. It's not found in the F1 command... I can see the other related command like: Remote-Containers: Settings.
Do you have any idea ? Or my setup is not supported by the extension ? It seems like it supports SSH development or Container development but not mixing both together, right ?
Is there any other VSCode config to debug in my targeted setup ?
Regards

Debugging a Go process in a container using Delve/Goland from the host

Before I burn hours trying it out I wanted to ask the community is this even possible?
Scenario:
Running Goland on host (may be any OS)
Running Go dev env in Alpine based container
Code on host volume mapped to container
Can I attach the Goland debugger (Delve) to a Go process in the container? I'm assuming I can run delve in the container headless and run the client on the host, punching whatever port is required? Will I have binary compatibility issues if the host is not linux?
I'd rather not duplicate the entire post in this answer, but have a look at this resource on how to use containers to run applications you write https://blog.jetbrains.com/go/2018/04/30/debugging-containerized-go-applications/
To answer this specifically, as long as you have Go, the application sources, and all dependencies installed on the host machine, you can develop in GoLand and then, using a mapped volume, you can also run it from the container.
However, this workflow sounds more like the workflow you'd normally have using VMs not containers, which is why in the above article all the running/debugging is done using the actual containers, rather than using bash inside a container to run those commands.

getting to the files system of the Alpine linux which runs Docker-for-mac

I am playing with the (awesome) new Docker-for-mac. As I understand it, it runs seamlessly on my mac in an Alpine Linux 'behind the scenes'. Is there a way to ssh into this host so I can see the file system. I want to see the place that docker is storing volume data in /var/lib/docker/....
EDIT: to be clear, it is the host filesystem I want access to, not the containers that run on it. this is the Alpine host
thanks
Docker for Mac doesn't use regular tcp networking for ssh, but you can connect to the unix socket on your Mac by using:
screen ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/tty
and login as root
This seems to be fairly undocumented so YMMV - it worked for me on Version 1.12.0-rc3-beta18 -- it might change in future versions.

Resources