26
10
submitted 4 months ago* (last edited 4 months ago) by trevor@lemmy.blahaj.zone to c/docker@programming.dev

I am looking for something that can take a Dockerfile, like the following as an input:


FROM --platform=linux/amd64 debian:latest
ENV DEBIAN_FRONTEND=noninteractive

RUN apt update && apt install -y curl unzip libsecret-1-0 jq
COPY entrypoint.sh .
ENTRYPOINT [ "/entrypoint.sh" ]

And produce a a multi-stage Dockerfile where the last stage is built from scratch, with the dependencies for the script in the ENTRYPOINT (or CMD) copied over, like this:


FROM --platform=linux/amd64 debian:latest as builder
ENV DEBIAN_FRONTEND=noninteractive

RUN apt update && apt install -y curl unzip libsecret-1-0 jq

FROM --platform=linux/amd64 scratch as app
SHELL ["/bin/bash"]

# the binaries executed in entrypoint.sh
COPY --from=builder /bin/bash /bin/bash
COPY --from=builder /usr/bin/curl /usr/bin/curl
COPY --from=builder /usr/bin/jq /usr/bin/jq
COPY --from=builder /usr/bin/sleep /usr/bin/sleep

# shared libraries of the binaries
COPY --from=builder /lib/x86_64-linux-gnu/libjq.so.1 /lib/x86_64-linux-gnu/libjq.so.1
COPY --from=builder /lib/x86_64-linux-gnu/libcurl.so.4 /lib/x86_64-linux-gnu/libcurl.so.4
COPY --from=builder /lib/x86_64-linux-gnu/libz.so.1 /lib/x86_64-linux-gnu/libz.so.1
# ...a bunch of other shared libs...

# entrypoint
COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT [ "/entrypoint.sh" ]

I've had pretty decent success creating images like this manually (using ldd to find the dependencies) based on this blog. To my knowledge, there's nothing out there that automates producing an image built from scratch, specifically. If something like this doesn't exist, I'm willing to build it myself.

27
7
submitted 4 months ago by sabreW4K3@lemmy.tf to c/docker@programming.dev
28
2
submitted 5 months ago by sabreW4K3@lemmy.tf to c/docker@programming.dev

I just installed Immich and while all my other containers have just required me to add to them to existing yaml, Immich requires its own yaml. That's fine I guess, but for the library, I wanna host it on my NAS and so I made the volume in my main Docker-Compose.yaml, the Immich yaml was all like, "what you talking about Willis?" because in my Immich environment I tried to point to something created in my main yaml. I thought I could work around this by adding an empty volume declaration, but now I can't find my uploads 😂 any idea on the correct methodology/workaround?

29
3

Whether you’re a Docker expert or new to the Docker community, you may be wondering about the best ways to optimize or get started quicker on Docker. Docker Captain Vladimir Mikhalev rounds up top Docker tips to help you supercharge developer productivity in 2024.

30
2
submitted 5 months ago by sabreW4K3@lemmy.tf to c/docker@programming.dev

How did your journey begin? I feel like Docker has been getting mentioned for aeons and I've only just started using it now.

31
2

I know this seem like a typical "Your opinion man" post but honestly, is there anything really useful beyond hosting an adblocker? (read: complementary, not found elsewhere, that enhances own's personal needs and/or life as a whole). And yes, I'm aware of what can be hosted -- picture editors, video editors, webtops, dhcpcd, emulators, and so on.

But the question is -- why I'd need all that if these stuff can be found on any ordinary PC out there? Even phones. Hell, even on a smart tv. That is like "trying to reinvent the wheel" for no necessary purpose other than "to look cool". There's also "because its fun", but is it really fun doing pretty much the same thing over and over again? There isn't a "learning gap" between these hosting options -- all of em have (pretty much) the same procedure to get things running.

With that said... I've been trying really, REALLY hard to host more stuff but I can't go beyond hosting (only) an adblocker.

32
3
submitted 6 months ago by mac@programming.dev to c/docker@programming.dev
33
3
submitted 6 months ago by mac@programming.dev to c/docker@programming.dev
34
3
submitted 6 months ago by mac@programming.dev to c/docker@programming.dev
35
8
submitted 6 months ago by mac@programming.dev to c/docker@programming.dev
36
2
submitted 7 months ago* (last edited 7 months ago) by luthis@lemmy.nz to c/docker@programming.dev

Not sure what I'm doing wrong here, I'm using this image:

https://hub.docker.com/r/bitnami/wordpress-nginx

I updated the compose file to have un/pw for mariadb:

  mariadb:
    image: docker.io/bitnami/mariadb:11.1
    volumes:
      - '/etc/docker/mariadb-persist:/bitnami/mariadb'
    environment:
      - ALLOW_EMPTY_PASSWORD=no
      - MARIADB_USER=admin
      - MARIADB_PASSWORD=admin
      - MARIADB_DATABASE=bitnami_wordpress

But I get this error:

2023-12-03 19:03:02 3 [Warning] Access denied for user 'admin'@'172.18.0.3' (using password: NO)

using password: NO??

37
11
submitted 7 months ago by mac@programming.dev to c/docker@programming.dev
38
1
submitted 8 months ago by abbadon420@lemm.ee to c/docker@programming.dev

Hello Lemmy,

I have to grade student work. Students who have made their first springboot applications. I'm wary for idiots who don't understand anything about java, yet somehow manage to include code that wipes my entire User folder, so I run the projects in docker these days.

One criterium is that they include a upload/download functionality. Some students decide to do that by storing the files in the DB, other store it in an "uploads" folder.

The first one works fine in docker. The second one not so much. The java code refers to a path "sourceroot/uploads", but that doesn't exist in the docker container. How can I make it exist in the docker container?

This is the DOCKERFILE I use to docker build -t image .

FROM eclipse-temurin:17-jdk-alpine
VOLUME /tmp
EXPOSE 8080
EXPOSE 5432
COPY target/*.jar application.jar
ENTRYPOINT ["java", "-jar", "application.jar"]

This is the yaml I use to run docker compose up -d

version: '2'

services:
  app:
    image: 'image'
    ports: 
        - "8080:8080"
    container_name: app
    depends_on:
      db:
        condition: service_healthy
    environment:
      - SERVER.PORT=8080
      - SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/testing
      - SPRING_DATASOURCE_USERNAME=postgres
      - SPRING_DATASOURCE_PASSWORD=postgres
      - SPRING_JPA_HIBERNATE_DDL_AUTO=create-drop
          
  db:
    image: 'postgres:13.1-alpine'
    ports:
      - "5432:5432"
    expose: 
      - "5432"
    container_name: db
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_HOST_AUTH_METHOD=trust
      - POSTGRES_DB=testing
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      timeout: 5s
      retries: 5
  

networks:
  default:
    name: docker

I'm sorry if this code offends anybody. I've made this Frankenstein's monster myself from bits and pieces. However, I can't seem to figure out how to add a working "uploads folder" to it that could be used by the springboot application inside the container. Any help would be appreciated.

39
1

What does the -d mean in the run command?

docker run -d -p 3355:3355/tcp -p author/image
40
1

I'm very new to Docker and Linux in general. My goal was to make my own server mainly for Plex. Now that I've got that running with the help of Dockstarter, I'm looking to branch out and I want to make sure my system is secure. I'm also running Ubuntu 'cause I for sure couldn't get this far with Terminal alone.

I use Private Internet Access as my VPN and I have it installed on my desktop environment. I've also been able to reroute my qBittorrent in a container through another container with Gluetun.

My prior setup is a Windows machine with PIA, kill switch enabled, qBit assigned to PIA adapter only.

So my question: What is more secure, PIA running on Ubuntu with a kill switch or tunneling each container through Gluetun?

I would like it to mirror my Windows setup but I couldn't figure out the network adapter situation with qBit.

41
1
submitted 10 months ago by hyper@lemmy.zip to c/docker@programming.dev

For example I have a docker compose stack with a service and a db.
How do you handle the passwords? Is it better to store them in a .env file or is there something different entirely?

Also do the passwords have to be strong if the db is only available to the service through the docker network?

42
1

According to the documentation to change the Portainer address and Edge agent talks to, you have to redeploy the Edge agent. If I understand properly this is going to assign the agent a new ID and will blow away the configuration.

Does anyone know how to do this while retaining the stack configurations?

43
1

On my search i found SQLPad, but its a legacy project in maintenance mode, so you may know something better? (An container with both Database System and integraded Webgui would also work, as long its an classic sql language - but i don't know if something like this even exists besides phpmyadmin desktop version - and while writing this i noticed that there exist also a container for this one 😂 - but you may know a insider tip?)

44
1
45
0
submitted 11 months ago by vd1n@lemmy.ml to c/docker@programming.dev

Throw ya hands uuuup.

46
1
47
1
submitted 11 months ago by vampatori@feddit.uk to c/docker@programming.dev

Starship is a really nice, fast, customisable shell prompt - of which there are many - but Starship supports a very wide range of things out-of-the-box.

Including docker context's. It detects Dockerfile and docker-compose.yml/yaml in the directory, and if you're not on the default context then it'll show the name of the context you're on in blue alongside a little whale icon. A tiny but very useful feature.

48
1

OrbStack is a fast, light, and simple way to run Docker containers and Linux machines on macOS. You can think of it as a supercharged WSL and Docker Desktop alternative, all in one easy-to-use app.

I just caught wind of this and have yet to try it. Does anyone here have any experience with OrbStack that they can speak to? 👀

49
1
50
1

So I have a project I'm working on with some friends on Github. I want automatically restart/recreate (shoudn't matter which of both) the container when someone pushs or merges on github. There for i use the portainer recreation webhook, which automatically deletes, pulls the image and recreates the container. The problem is, that the static ip i gave the container on creation is not adopted to the new container (normaly it should, there also exists an issue on their github project, which describes my problem). The only workaround i found is downgrading. I need the static ip for a nginx reverse proxy, which also runs in a container, connected to the same network. Do you know of any alternatives to the portainer recreation webhook, as a restart of the container would be suffice? Or how to handle shuffling ips in a nginx container?

view more: ‹ prev next ›

Docker

966 readers
1 users here now

founded 1 year ago
MODERATORS