Linux/Docker/Docker-Compose: Difference between revisions

From Wiki
< Linux‎ | Docker
No edit summary
No edit summary
Line 12: Line 12:


== Ubuntu testing ==
== Ubuntu testing ==
* build from Dockerfile
* keep running without task
* keep running without task
* connect to bridge network "lan"
* connect to bridge network "lan"
Line 26: Line 27:
       name: lan
       name: lan
</pre>
</pre>
== Volumes ==
<pre>
version: '3'
services:
  web:
    build: .
    volumes:
      - /hostfilesystem:/containerfilesystem
</pre>
== Ports ==
* hostport: 8080
* containerport: 80
<pre>
version: "3"
services:
  wordpress:
    image: wordpress
    ports:
      - "8080:80"
</pre>


== OpenVPN ==
== OpenVPN ==

Revision as of 14:58, 26 January 2019

Basics

docker-compose build
docker-compose up
docker-compose up -d
docker-compose stop

Ubuntu testing

  • build from Dockerfile
  • keep running without task
  • connect to bridge network "lan"
version: '3'
services:
  test123:
    build: .
    stdin_open: true

networks:
  default:
    external:
      name: lan


Volumes

version: '3'

services:
  web:
    build: .
    volumes:
      - /hostfilesystem:/containerfilesystem

Ports

  • hostport: 8080
  • containerport: 80
version: "3"

services:
  wordpress:
    image: wordpress
    ports:
      - "8080:80"


OpenVPN

  • "cap_add" = add capabilities (here for changing network settings)
version: '3'

services:
  openvpn:
    build: .
    ports:
      - 1194:1194
    cap_add:
     - NET_ADMIN