Tuesday, August 29, 2023

Install Docker-Compose

 

Docker-Compose

sudo apt update

ansible@ansible-VirtualBox:/home/docker$ sudo apt install docker-compose
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following additional packages will be installed:
  python3-attr python3-cached-property python3-docker python3-dockerpty python3-docopt python3-jsonschema python3-pyrsistent python3-texttable python3-websocket
Suggested packages:
  python-attr-doc python-jsonschema-doc
Recommended packages:
  docker.io
The following NEW packages will be installed:
  docker-compose python3-attr python3-cached-property python3-docker python3-dockerpty python3-docopt python3-jsonschema python3-pyrsistent python3-texttable python3-websocket
0 upgraded, 10 newly installed, 0 to remove and 278 not upgraded.
Need to get 390 kB of archives.
After this operation, 2,303 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu groovy/universe amd64 python3-cached-property all 1.5.1-4 [10.9 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu groovy/universe amd64 python3-websocket all 0.53.0-2ubuntu1 [32.3 kB]
Get:3 http://in.archive.ubuntu.com/ubuntu groovy/universe amd64 python3-docker all 4.1.0-1.2 [83.6 kB]
Get:4 http://in.archive.ubuntu.com/ubuntu groovy/universe amd64 python3-dockerpty all 0.4.1-2 [11.1 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu groovy/universe amd64 python3-docopt all 0.6.2-2.2ubuntu1 [19.7 kB]
Get:6 http://in.archive.ubuntu.com/ubuntu groovy/main amd64 python3-attr all 19.3.0-5 [33.8 kB]
Get:7 http://in.archive.ubuntu.com/ubuntu groovy/main amd64 python3-pyrsistent amd64 0.15.5-1build1 [52.1 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu groovy/main amd64 python3-jsonschema all 3.2.0-0ubuntu2 [43.1 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu groovy/universe amd64 python3-texttable all 1.6.2-2 [11.0 kB]
Get:10 http://in.archive.ubuntu.com/ubuntu groovy/universe amd64 docker-compose all 1.25.0-1 [92.7 kB]
Fetched 390 kB in 1s (281 kB/s)      
Selecting previously unselected package python3-cached-property.
(Reading database ... 271944 files and directories currently installed.)
Preparing to unpack .../0-python3-cached-property_1.5.1-4_all.deb ...
Unpacking python3-cached-property (1.5.1-4) ...
Selecting previously unselected package python3-websocket.
Preparing to unpack .../1-python3-websocket_0.53.0-2ubuntu1_all.deb ...
Unpacking python3-websocket (0.53.0-2ubuntu1) ...
Selecting previously unselected package python3-docker.
Preparing to unpack .../2-python3-docker_4.1.0-1.2_all.deb ...
Unpacking python3-docker (4.1.0-1.2) ...
Selecting previously unselected package python3-dockerpty.
Preparing to unpack .../3-python3-dockerpty_0.4.1-2_all.deb ...
Unpacking python3-dockerpty (0.4.1-2) ...
Selecting previously unselected package python3-docopt.
Preparing to unpack .../4-python3-docopt_0.6.2-2.2ubuntu1_all.deb ...
Unpacking python3-docopt (0.6.2-2.2ubuntu1) ...
Selecting previously unselected package python3-attr.
Preparing to unpack .../5-python3-attr_19.3.0-5_all.deb ...
Unpacking python3-attr (19.3.0-5) ...
Selecting previously unselected package python3-pyrsistent:amd64.
Preparing to unpack .../6-python3-pyrsistent_0.15.5-1build1_amd64.deb ...
Unpacking python3-pyrsistent:amd64 (0.15.5-1build1) ...
Selecting previously unselected package python3-jsonschema.
Preparing to unpack .../7-python3-jsonschema_3.2.0-0ubuntu2_all.deb ...
Unpacking python3-jsonschema (3.2.0-0ubuntu2) ...
Selecting previously unselected package python3-texttable.
Preparing to unpack .../8-python3-texttable_1.6.2-2_all.deb ...
Unpacking python3-texttable (1.6.2-2) ...
Selecting previously unselected package docker-compose.
Preparing to unpack .../9-docker-compose_1.25.0-1_all.deb ...
Unpacking docker-compose (1.25.0-1) ...
Setting up python3-cached-property (1.5.1-4) ...
Setting up python3-attr (19.3.0-5) ...
Setting up python3-texttable (1.6.2-2) ...
Setting up python3-docopt (0.6.2-2.2ubuntu1) ...
Setting up python3-pyrsistent:amd64 (0.15.5-1build1) ...
Setting up python3-websocket (0.53.0-2ubuntu1) ...
update-alternatives: using /usr/bin/python3-wsdump to provide /usr/bin/wsdump (wsdump) in auto mode
Setting up python3-dockerpty (0.4.1-2) ...
Setting up python3-docker (4.1.0-1.2) ...
Setting up python3-jsonschema (3.2.0-0ubuntu2) ...
Setting up docker-compose (1.25.0-1) ...
Processing triggers for man-db (2.9.3-2) ...
ansible@ansible-VirtualBox:/home/docker$
ansible@ansible-VirtualBox:/home/docker$ docker-compose --version
docker-compose version 1.25.0, build unknown


ansible@ansible-VirtualBox:/home/docker$ docker-compose up
ERROR:
        Can't find a suitable configuration file in this directory or any
        parent. Are you in the right directory?

        Supported filenames: docker-compose.yml, docker-compose.yaml

ansible@ansible-VirtualBox:/home/docker$ cat docker-compose.yml
version: "3"
services:
  web:
    build: .
    ports:
      - "5000:5000"
  redis:
    image: "redis:alpine"

ansible@ansible-VirtualBox:/home/docker$ docker-compose config
services:
  redis:
    image: redis:alpine
  web:
    build:
      context: /home/docker
    ports:
    - 5000:5000/tcp
version: '3.0'

docker-compose up

docker-compose down