Get the App
SLTechnology News&Howtos  ›  Servers  › 

Docker create volume specify volume export image import image

Shulou Source: shulou.com Published: 2022-06-02 06:56:20 09月28日 Update

DockerfileFROM openjdk:8WORKDIR / hgs/java/#RUN ["/ bin/sh", "- c", "rm-f / hgs/java/docker.jar"] COPY. / docker.jar / hgs/java/COPY. / test.sh / hgs/java/#CMD java-cp / hgs/java/docker.jar dockertest.t.MainCMD sh. / test.sh1.docker container Runtime files are not visible to the outside. Container disappears after the exit provides three ways to manage files volumes,bind mounts for this docker. Volumes: managed by docker / var/lib/docker/volumes/ on Linux can be created by docker volume create bind mounts: is the absolute path of the machine does not need to pre-exist tmpfs: put in memory 2. Create volume docker volume create my-vol to view the details of volume docker volume ls volume docker volume inspect my-vol delete volume docker volume rm my-vol run container under the specified volume (version 1.13.1 docker may not support-- mount discussed here-v (--volume)) docker run-d-v my-vol:/hgs/tmp hello:1.1 docker run-v myv:/hgs / x hello:1.1 # myv:/hgs/x is consistent with Dockerfile's WORKDIR to remove files under volume This operation actually starts a container of centos:7 to delete docker run-- rm-v fjava:/hgs/centos centos:7 rm-rf / hgs/centos/docker.jar publish image to library docker save fjava1:latest-o / home/fjava.tar.gz #-o specify export path export image docker load-I / home/fjava.tar.gz # #-I /-- input specify import path

Tags: Files paths mirrors management runs details consistency memory external mode time machine version management files external support Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Huawei macOS Microsoft Linux