Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

volumes docker compose

version: "2.4"
services:
  web:
    image: nginx:alpine
    ports:
      - "80:80"
    volumes:
      - type: volume
        source: mydata
        target: /data
        volume:
          nocopy: true
      - type: bind
        source: ./static
        target: /opt/app/static

networks:
  webnet:

volumes:
  mydata:
Comment

docker compose volumes

##### Short Syntax #####

volumes:
  # Just specify a path and let the Engine create a volume
  - /var/lib/mysql

  # Specify an absolute path mapping
  - /opt/data:/var/lib/mysql

  # Path on the host, relative to the Compose file
  - ./cache:/tmp/cache

  # User-relative path
  - ~/configs:/etc/configs/:ro

  # Named volume
  - datavolume:/var/lib/mysql

##### Long Syntax #####

version: "3.2"
services:
  web:
    image: nginx:alpine
    ports:
      - "80:80"
    volumes:
      - type: volume
        source: mydata
        target: /data
        volume:
          nocopy: true
      - type: bind
        source: ./static
        target: /opt/app/static

networks:
  webnet:

volumes:
  mydata:

Check out https://docs.docker.com/compose/compose-file/#long-syntax-3 for more info.
Comment

docker compose volumes

/host/path:/container/path
Comment

docker compose volume mounts

volumes:
    - ./:/app
Comment

PREVIOUS NEXT
Code Example
Shell :: uname linux 
Shell :: unable to delete c2dd1984ad5b (must be forced) - image is being used by stopped container 
Shell :: how to view the list of your environments in your terminal or Anaconda prompt 
Shell :: sed replace with newline 
Shell :: how to install gdal on pyhon 3.9 
Shell :: E: Unable to locate package libclang-cpp-dev 
Shell :: bash get files older than 
Shell :: how to open files using terminal in ubuntu 
Shell :: cannot reindex from a duplicate axis 
Shell :: poetry delete environment 
Shell :: git clone password authentication failed 
Shell :: find the process ID of a running process bash 
Shell :: nano enable syntax highlighting 
Shell :: run sh file 
Shell :: how to ssh to another computer 
Shell :: bash: telnet: commande inconnue. 
Shell :: run node api on rapberry pi 
Shell :: ubuntu set deepin terminal as default 
Shell :: installing kubernetes on ubuntu 20.04 
Shell :: crontab reload 
Shell :: shortan promt ubunto 
Shell :: list relative path windows 
Shell :: vscode add folder to workspace cli 
Shell :: mailutils check mail 
Shell :: first time linux 
Shell :: vim error in ubuntu 
Shell :: How to list all unit files with systemctl command 
Shell :: install telepresence in mac 
Shell :: git merge branch into main 
Shell :: uninstall packages atom 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =