I created a minimal docker-compose.yml file, something like this
version: '3.7'
services:
odoo:
image: odoo:14.0
container_name: odoo-app
restart: always
command:
--without-demo all
then create a new docker context using
sudo docker context create remote --docker "host=ssh://root#my-remote.server.com:2222"
i can see the new created context using
sudo docker context ls
i can connect to ssh without problem
When i try to run this deployment nothing happen
(venv) augusto#augusto-NUC10i7FNH:~/Progetti/odoo$ sudo docker-compose --verbose --context remote -f docker-compose.yml -f docker-compose.prod.yml up -d
compose.config.config.find: Using configuration files: ./docker-compose.yml,./docker-compose.prod.yml
(venv) augusto#augusto-NUC10i7FNH:~/Progetti/odoo$
why?
Both hosts (local and remote server) have Ubuntu 20.04 and the same version of docker-compose
docker-compose version 1.28.2, build unknown
docker-py version: 4.4.1
CPython version: 3.8.5
OpenSSL version: OpenSSL 1.1.1f 31 Mar 2020
Related
I am running through a problem where I can't mount Unix docker socket to an alpine container but works with ubuntu container.
docker-compose using alpine image
version: '3.8'
services:
cluster:
image: alpine
tty: true
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "/usr/bin/docker:/usr/bin/docker"
running docker command in the alpine container:
/ # docker --version
sh: docker: not found
docker-compose using ubuntu image
version: '3.8'
services:
cluster:
image: ubuntu:20.04
tty: true
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "/usr/bin/docker:/usr/bin/docker"
running docker command in the ubuntu container:
root#5f30b4143c43:/# docker --version
Docker version 20.10.12, build e91ed57
I don't get why I can access my host docker env using the ubuntu container but not with the alpine one? is there anything missing in the configuration?
Your error has nothing to do with the socket:
/ # docker --version
sh: docker: not found
You're seeing this because you're trying to run a binary compiled for glibc platform, while Alpine is built using MUSL libc.
You would need to install a version of the docker client built specifically for use under Alpine (or just pick almost any other image).
I want to use network_mode: "host" on docker-compose but it was rejected.
$ cat docker-compose.yml
version: "3.7"
services:
hello:
image: hello-world:latest
$ docker-compose up
Creating network "tmp_default" with the default driver
Creating tmp_hello_1 ... done
Attaching to tmp_hello_1
hello_1 |
hello_1 | Hello from Docker!
hello_1 | This message shows that your installation appears to be working correctly.
:
tmp_hello_1 exited with code 0
OK. Let me use network_mode: "host"
$ nano docker-compose.yml
$ cat docker-compose.yml
version: "3.7"
network_mode: "host"
services:
hello:
image: hello-world:latest
$ docker-compose up
ERROR: The Compose file './docker-compose.yml' is invalid because:
Invalid top-level property "network_mode". Valid top-level sections for this Compose file are: version, services, networks, volumes, secrets, configs, and extensions starting with "x-".
WHY!? this is official isn't it?
https://docs.docker.com/compose/compose-file/#network_mode
$ docker-compose -v
docker-compose version 1.24.1, build 4667896b
$ docker -v
Docker version 19.03.2, build 6a30dfca03
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="19.04 (Disco Dingo)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 19.04"
VERSION_ID="19.04"
network_mode is not top level property. Write it under service.
version: "3.7"
services:
hello:
network_mode: "host"
image: hello-world:latest
I'm trying to setup docker & compose for running integration tests
I have the following docker-compose.yml
version: '3'
services:
tests:
build:
context: .
dockerfile: Dockerfile.tests
links:
- web
- maindb
web:
build:
context: .
dockerfile: Dockerfile.web
ports:
- "8080:8080"
volumes:
- .:/code
- logvolume01:/var/log
links:
- maindb
maindb:
image: postgres
environment:
POSTGRES_PASSWORD: example
volumes:
logvolume01: {}
web container itself works pretty fine
$ docker-compose -p wh run web
Starting wh_maindb_1 ... done
2017/07/27 22:05:34 [I] http server Running on http://:8080
But when I run tests container, I get the error
$ docker-compose -p wh run tests
Starting wh_maindb_1 ... done
Starting 6faff07f7671_6faff07f7671_wh_web_1 ...
Starting 6faff07f7671_6faff07f7671_wh_web_1 ... error
ERROR: for 6faff07f7671_6faff07f7671_wh_web_1 Cannot start service web: oci runtime error: container_linux.go:262: starting container process caused "exec: \"web\": executable file not found in $PATH"
Here is my Dockerfile.web
$ cat Dockerfile.web
FROM ubuntu:xenial
WORKDIR /app
ADD bin/* /app/
CMD ["/app/web"]
/app/web is dynamically linked daemon written in Golang 1.6
And some version info
$ docker version
Client:
Version: 17.06.0-ce
API version: 1.30
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:23:31 2017
OS/Arch: linux/amd64
Server:
Version: 17.06.0-ce
API version: 1.30 (minimum version 1.12)
Go version: go1.8.3
Git commit: 02c1d87
Built: Fri Jun 23 21:19:04 2017
OS/Arch: linux/amd64
Experimental: false
$ docker-compose version
docker-compose version 1.14.0, build c7bdf9e
docker-py version: 2.4.2
CPython version: 2.7.12
OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
This is maybe related to some docker-compose bug.
Try cleaning containers
docker-compose down
Alternatively this (you will lose your container data):
docker rm -f $(docker ps -a -q)
How do I tell CircleCI and docker-compose to run Redis with persistent storage? I expected to see something like docker run -d -p 6379:6379--name redis dockerfile/redis in circle.yml where I can add a -v <data-dir>:/data to, but I only see redis listed under services: in circle.yml:
machine:
services:
- redis
node:
version: 6.3.0
python:
version: 3.5.2
# ...deployment commands follow, but no redis
I am trying to run haproxy in a docker container. To build and run the haproxy from the image, docker-compose reads my .yaml file below.
proxy:
build: ./
env_file: .env
ports:
- "8000:80"
- "9000:9000"
After executing a docker-compose build, the image is created but while trying to spawn a container using the following, I am getting the following errors:
$ docker-compose up -d
Starting my_haproxy_container
←[31mERROR←[0m: Container command could not be invoked.
By docker install information:
$ docker version
Client:
Version: 1.10.2
API version: 1.22
Go version: go1.5.3
Git commit: c3959b1
Built: Mon Feb 22 22:37:33 2016
OS/Arch: windows/amd64
Server:
Version: 1.10.3
API version: 1.22
Go version: go1.5.3
Git commit: 20f81dd
Built: Thu Mar 10 21:49:11 2016
OS/Arch: linux/amd64
I am not sure why the docker-compose up -d is unable to bring up the container. Any information is much appreciated. Thank you.
Container command could not be invoked
Is means you have problems with CMD in your Dockerfile. It is not docker-compose problem.
Incorrect CMD command
Command in CMD tries to run file without -execute permission
Check you ./Dockerfile