1.报错:
/usr/bin/docker-current: Error response from daemon: driver failed programming external connectivity on endpoint exchange2 (99119ad03c638e8d6282aa2480202dd3adfb9faeab6193f2d677d5363641a894): iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 32777 -j DNAT --to-destination 172.17.0.10:22 ! -i docker0: iptables: No chain/target/match by that name.
处理:
[root@node ~]# iptables -t nat -F
[root@node ~]# systemctl stop docker
[root@node ~]# iptables -t nat -F
[root@node ~]# nmcli c down docker0
Connection 'docker0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/1)
[root@node ~]# nmcli c up docker0
Error: Connection 'docker0' does not exist.
[root@node ~]# systemctl restart docker
2.install compose:
curl -L https://github.com/docker/compose/releases/download/1.14.0-rc2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
基本操作流程:
1024 mkdir composetest
1025 cd composetest
1026 vi app.py
[root@node composetest]# cat app.py
from flask import Flask
from redis import Redis
app = Flask(__name__)
redis = Redis(host='redis', port=6379)
@app.route('/')
def hello():
count = redis.incr('hits')
return 'Hello World! I have been seen {} times.
'.format(count)
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)
[root@node composetest]#
1027 vi requirements.txt
[root@node composetest]# cat requirements.txt
flask
redis
[root@node composetest]#
1028 vi Dockerfile
[root@node composetest]# cat Dockerfile
FROM python:3.4-alpine
ADD . /code
WORKDIR /code
RUN pip install -r requirements.txt
CMD ["python", "app.py"]
[root@node composetest]#
1029 vi docker-compose.yml
[root@node composetest]# cat docker-compose.yml
version: '2'
services:
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/code
redis:
image: "redis:alpine"
[root@node composetest]#
1030 docker-compose up
1031 docker image ls
1032 docker images
1033 docker-compose up -d
1034 docker-compose ps
[root@node composetest]# docker-compose ps
Name Command State Ports
-------------------------------------------------------------------------------------
composetest_redis_1 docker-entrypoint.sh redis ... Up 6379/tcp
composetest_web_1 python app.py Up 0.0.0.0:5000->5000/tcp
[root@node composetest]#
ok!!!
6.installed odoo
1043 docker create --name unkkuri-db-data library/postgres:9.4 /bin/true
1044 docker run -d --name unkkuri-db --env POSTGRES_USER=odoo --env POSTGRES_PASSWORD=unkkuri-secret-pw --volumes-from unkkuri-db-data library/postgres:9.4
1045 docker logs unkkuri-db
1046 docker create -v /var/lib/odoo --name unkkuri-odoo-data odoo:10.0 /bin/true
1047 docker run -d --name unkkuri-odoo --link unkkuri-db:db -p 8069:8069 --volumes-from unkkuri-odoo-data odoo:10.0 odoo --db_password=unkkuri-secret-pw
1048 docker logs unkkuri-odoo