Comments (8)
please open a PR
from docker.
I think the documentation is right. If you 'run' a new jenkins container without anything specified regarding the volume /var/jenkins_home, all data written there will be lost when you remove the container.
You basically have two options to make this data persistent across re-creating the jenkins container:
- mount a directory from the host, or
- link the volumes to a Data Volume Container
Off course, a not-bound volume actually exists on the disk in a docker-controlled volume. But it lives and dies with the container. When you pull a new version of the image and re-create the container, you loose the data.
Furthermore, the Docker documentation seems to suggest not to access files in containers through the host file system, but to use Docker-supplied commands.
from docker.
Actually, volumes don't die with the container unless you do docker rm -v
. But good luck finding the folder that has your data! It's just subtleties like this that can mislead people.
Sorry for not coming up with a pull-request. I'm flat out at the minute, so it won't be this week either.
from docker.
You would have to do the docker rm
as soon as you want to upgrade to a new version, wouldn't you?
from docker.
You could - and I'm certainly not advocating this approach - use docker inspect
to find out where docker is keeping your volume, use docker rm
without the -v
to remove the container, then launch a new container with the volume bind mounted docker run -v /var/lib/docker/....:/var/jenkins_home ...
.
from docker.
We might be misunderstanding each other so I'm trying to rephrase it a bit.
- Your original post seems to suggest accessing the files in the container using the hosts files system. At my current level of understanding Docker I would suggest not to do it.
- If you want the data in your volumes to persist, I would (and actually do) use a host-mounted volume, or a Data Volume container. Neither option requires
docker inspect
to find out where the data lives on the disk
from docker.
I'm not suggesting accessing the files from the host, as much as just saying it's possible. (Although you are accessing the files from the host whatever you do, it's just you normally go via the container).
I think the wording "make that a persistent volume" is misleading, as there's not really such a thing as a transient volume. This misunderstanding is reinforced by the docker cp advice, which implies a running container is necessary to access the data and it disappears with the container. This very much isn't the case.
I would just reword a bit and replace the docker cp advice with something like docker run --volumes-from myjenkins -v $(pwd):/backup debian tar cvf /backup/backup.tar /var/jenkins_home
(Note that's untested and off the top of my head, but based on the example in the docker docs).
UPDATE: I suppose docker run --rm jenkins
creates a transient volume. But that's not what we're discussing.
from docker.
OK. I stand corrected.
Removing the jenkins container docker rm jenkins
(without -v
) will keep the container intact on your disk....but there seems to be no easy way to discover it. My guess would be that for most users this is equivalent to being lost (me included, until now - I have 'lost' some data this way before).
from docker.
Related Issues (20)
- apt fails on fips-enabled hosts HOT 6
- apt-get update fails with signatures couldn't be verified because the public key is not available HOT 6
- windowsservercore-2019 image not updated HOT 5
- Ship production build of Java 21 from Eclipse Temurin HOT 3
- Upgrade curl to >=8.4.0 to fix CVE-2023-38545 HOT 3
- CVE-2023-38039, CVE-2023-38408, CVE-2023-38039, CVE-2023-38039, CVE-2023-44487 HOT 4
- Unexpected loss of more precise labels in favor of less precise labels HOT 13
- The directory separator used in the Windows build script is dependent on the OS
- latest with jdk17 & almalinux HOT 2
- Update Docker Hub description with JDK17 images instead of JDK11 HOT 2
- Set JDK17 as the default JDK for Windows image
- Publish a Windows image for each supported Java version HOT 2
- `windowsservercore-2019` images use `windowsservercore-1809` as base image HOT 2
- Windows - There should be a set of weekly and LTS short tags not including Jenkins version in their names HOT 4
- After Jenkins docks with ldap, the first login the next day will display a password error. The second login will be successful, and submitting the pipeline using Jenkins' API will fail. Jenkins logs indicate that the connection to ldap has timed out
- JenkinsProject
- `jenkins-plugin-cli` reports `War not found, installing all plugins: /usr/share/java/jenkins.war` HOT 5
- CVE-2024-23897 still exists in latest LTS version jenkins/jenkins:2.440.1-lts-jdk11 HOT 2
- The repository 'https://packagecloud.io/github/git-lfs/debian bookworm InRelease' is not signed. HOT 1
- CVE-2024-22201 still appears in jenkins/jenkins:2.444-jdk11 image HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker.