Docker

1219 readers
1 users here now

founded 2 years ago
MODERATORS
26
27
 
 

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.

28
 
 

What does the -d mean in the run command?

docker run -d -p 3355:3355/tcp -p author/image
29
 
 

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.

30
 
 

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?

31
 
 

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?

32
 
 

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?)

33
34
 
 

Throw ya hands uuuup.

35
36
 
 

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? ๐Ÿ‘€

37
38
 
 

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?

39
40
 
 

Mine are so far:

  • Nextcloud
  • poste.io
  • portainer
  • founryvtt
  • and some gameserver:
    • Minecraft
    • Avorion
    • Satisfactory
    • Factorio