Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dot and colon meaning

What does dot-colon .:

- .:/var/www/project:cached

mean in situation like this:

version: '3'
services:
  php:
    image: php:7.1-fpm
    ports:
      - 9000
    volumes:
      - .:/var/www/project:cached

Is this part of bash syntax or is it part of Docker syntax (haven't found any info on both).

like image 600
0leg Avatar asked Mar 23 '18 11:03

0leg


People also ask

What does a dot and a colon mean?

The dot-dot — the colonPut a colon before your explanation. Lucy told me yesterday she has three nanas: Nana Trina; Nana (Josie); and Nana Coll, who's actually Lucy's great aunt. I've come along with four of my workmates: Jayne, Lynda, Reece, and Inez.

What does semicolon and colon mean?

Colons introduce or define something. The primary use of semicolons is to join two main clauses. The difference between semicolons and colons is that colons can combine two independent clauses, but their primary use is to join independent clauses with a list or a noun.

What does the symbol colon mean?

The colon ( : ) is a mark of punctuation used after a statement (such as an independent clause) or that introduces a quotation, an explanation, an example, or a series.

Is a colon two dots?

A colon is a punctuation mark consisting of two dots, one placed above the other. It looks like this : Colons are often used to introduce a list, but that's not all they can do! Think of a colon as a flashing sign that points to your text.


2 Answers

  • . is used for "current directory"
  • : is used to separate the host's path from container's path. (Each volume uses a source path for the host and a destination path for the container).
  • :cached seems to be a caching option for docker-for-mac

From the docs:

Short syntax

Optionally specify a path on the host machine (HOST:CONTAINER), or an access mode (HOST:CONTAINER:ro).

You can mount a relative path on the host, that expands relative to the directory of the Compose configuration file being used. Relative paths should always begin with . or ...

like image 168
tgogos Avatar answered Nov 07 '22 07:11

tgogos


As per documentation:

Optionally specify a path on the host machine (HOST:CONTAINER), or an access mode (HOST:CONTAINER:ro).

You can mount a relative path on the host, that expands relative to the directory of the Compose configuration file being used. Relative paths should always begin with . or ...

The . is a directory where docker-compose file is located. It will be mounted to the path after the colon.

like image 31
eyevan Avatar answered Nov 07 '22 05:11

eyevan