๐ Hi, Iโm @anujdatar
Educator and developer, who likes to work on random projects and learn new things.
Some of my work:
CUPS server running in a docker container
License: GNU General Public License v3.0
i've got a thermal label printer that i have working connected to my server and running from the docker image, which i can then print from my mac to...but the problem is that it's always printing the wrong size. i've got a 4x6 label that i'm trying to print and it's set to print to a 4x6 label in mac os and the default paper size on the server is set to 4x6, but it just doesn't print correctly. ever. it's printing the top of the label at the very bottom and only actually printing maybe the top inch or so at the very bottom of the label.
any ideas? i've been pulling my hair out for hours trying to figure out what i'm doing wrong and i've got nothing.
I was able to map this printer through Windows 11 just fine, using "select a shared printer by name". But I'm unsure how to map this printer on my MacBook?
It works fine when i restart the docker container, so I think its having trouble finding the /dev/usb/[], since it changes when the printer is reconnected container host's OS.
Not sure that I set up something wrong, or its an issue with the container.
docker-compose.yml:
services:
cups:
image: anujdatar/cups
container_name: cups
restart: always
ports:
- "631:631"
devices:
- /dev/bus:/dev/bus
- /dev/usb:/dev/usb
environment:
- CUPSADMIN=admin
- CUPSPASSWORD=password
- TZ="Europe/Warsaw"
volumes:
- ./data:/etc/cups
data/printers.conf:
# Written by cupsd
# DO NOT EDIT THIS FILE WHEN CUPSD IS RUNNING
NextPrinterId 2
<Printer EPSON_L310_Series>
PrinterId 1
UUID urn:uuid:aa358d43-05a5-31db-6324-f9e9d4e078b6
Info EPSON L310 Series
Location
MakeModel Epson L310 - CUPS+Gutenprint v5.3.4
DeviceURI usb://EPSON/L310%20Series?serial=56484D4B3032353618
State Idle
StateTime 1712484122
ConfigTime 1711806586
Type 8425484
Accepting Yes
Shared Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0
OpPolicy default
ErrorPolicy retry-job
</Printer>
Thanks for this useful software, I run it in a Proxmox Ubuntu VM in a Docker container. It does what Google Cloud print used to do for me. Any word on adding persistence?
I saw your attempt to enable auto-discovery in this commit added avahi-daemon, and exposed port 5353/udp for multicast dns
While that's the correct direction, the normal linux systemd work in a little more complex way.
Specifically, compare to a normal working service, you also need to start process avahi-daemon.service
and cups-browsed.service
You can look here
/usr/lib/systemd/system/cups-browsed.service
/etc/systemd/system/printer.target.wants/cups.service
/usr/lib/systemd/system/avahi-daemon.service
As you can see, it's quite complex to start all the services using your entrypoint.
In order to accomplish that you could take a look at supervisord
and tini
or my prefered method s6-overlay
.
With s6-overlay
, you could create many services. Take a look at an example below (generated by ChatGPT)
The s6-overlay is a powerful init system designed for use with Docker containers, allowing you to manage multiple processes within a single container. Here's a basic guide on how to use s6-overlay in a Dockerfile to start multiple processes:
Create a Dockerfile:
Create a new Dockerfile for your application. Here's a basic example:
FROM your-base-image
# Install s6-overlay
ADD https://github.com/just-containers/s6-overlay/releases/download/v2.2.0.3/s6-overlay-amd64.tar.gz /tmp/
RUN tar xzf /tmp/s6-overlay-amd64.tar.gz -C / \
&& rm /tmp/s6-overlay-amd64.tar.gz
# Add your application files
COPY ./app /app
# Add s6 service definitions
COPY ./services /etc/services.d
# Command to start s6-init
CMD ["/init"]
In this example, replace your-base-image
with the base image you want to use, and ./app
with the path to your application files.
Create a services directory:
Create a directory called services
in the same directory as your Dockerfile. Inside this directory, you will define service scripts for each process you want to run.
For example, if you want to run two processes, create files like services/app1/run
and services/app2/run
. The contents of these files might look like:
# services/app1/run
#!/usr/bin/with-contenv sh
exec /app/app1
# services/app2/run
#!/usr/bin/with-contenv sh
exec /app/app2
These scripts will be executed by s6 when the container starts.
Build your Docker image:
Run the following command to build your Docker image:
docker build -t your-image-name .
Run your Docker container:
Now, you can run your Docker container:
docker run -d your-image-name
The s6-overlay will manage the specified processes, and you can scale this approach to include more services as needed. The key is to create service scripts in the services
directory, and s6 will take care of starting and managing those services within the Docker container.
The package printer-driver-all
is a meta package, that only recommends other packages.
After the update any instance depending on one of those packages is not non functional (my brother printer stopped working for example).
when there was a build on raspberry pi zero w (ARCH=arm32v6)
after cloning the repository, it returns the following error.
=> CACHED [5/6] COPY entrypoint.sh / 0.0s
=> ERROR [6/6] RUN chmod +x /entrypoint.sh 7.0s
------
> [6/6] RUN chmod +x /entrypoint.sh:
5.351 runc run failed: unable to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory
------
Dockerfile:51
--------------------
49 |
50 | COPY entrypoint.sh /
51 | >>> RUN chmod +x /entrypoint.sh
52 |
53 | CMD ["/entrypoint.sh"]
--------------------
ERROR: failed to solve: process "/bin/sh -c chmod +x /entrypoint.sh" did not complete successfully: exit code: 1
Hi,
I installed CUPS on TrueNas Scale, added printer and checked to share this printer but it isn't visible in Server shared folder. After investigation it looks like SAMBA is not installed and that is why it isn't visible for windows in shared folder. Will it be possible to add by default SAMBA as installed app?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.