skip to Main Content

Container not writing data to physical disk file – Docker

Python Code: import datetime,os data = "" with open("D://PythonService//Test.txt", "w") as outFile: outFile.write(data + "Service started at - {}n".format(datetime.datetime.now())) outFile.close() Dockerfile FROM python:latest COPY requirements.txt . RUN python -m pip install -r requirements.txt WORKDIR /app COPY . /app CMD ["python",…

VIEW QUESTION

Docker Swarm Persist DB Data

I've seen variations of this question but for some reason I think I'm missing something. Problem I'm running a couple of containers on docker swarm. Every time my DB container, or backend container restarts, the database gets cleared. I thought…

VIEW QUESTION

What is the path for application.properties (or similar file) in docker container?

I am dockerizing springboot application(with PostgreSQL). I want to overwrite application.properties in docker container with my own application.properties. My docker-compose.yml file looks like this: version: '2' services: API: image: 'api-docker.jar' ports: - "8080:8080" depends_on: - PostgreSQL environment: - SPRING_DATASOURCE_URL=jdbc:postgresql://PostgreSQL:5432/postgres -…

VIEW QUESTION

Create database on docker startup

I want to create mysql database on docker-compose startup from database.sql script. My database.sql script is on location: src/main/java/com/project_name/resources/db/database.sql. How should I wrote that in my docker-compose.yml file? Right now neither works. volumes: - ./database.sql:/data/application/database.sql or something like: volumes: -…

VIEW QUESTION

How do I delete Postgres docker volume?

I have a docker-compose.yml which I am using to deploy to a remote host from my local (Mac) machine using docker context. The compose config is as follows: database: image: postgres:14.2 restart: on-failure volumes: - ./db-data:/var/lib/postgresql/data environment: POSTGRES_DB: db POSTGRES_USER:…

VIEW QUESTION
Back To Top
Search