fernandohackbart / bikeride-lagom

Sample Bike Ride application backend to learn Lagom
Other
4 stars 2 forks source link

Setup simple environment with Docker over openSuSE #133

Closed fernandohackbart closed 7 years ago

fernandohackbart commented 7 years ago
systemctl start docker
systemctl enable docker
systemctl stop docker
systemctl restart docker
fernandohackbart commented 7 years ago
fernandohackbart commented 7 years ago
fernandohackbart commented 7 years ago
docker stop jenkins
docker start jenkins
fernandohackbart commented 7 years ago
docker stop bind
docker start bind
# docker inspect bind|grep IPAddress
            "SecondaryIPAddresses": null,
            "IPAddress": "172.17.0.2",
                    "IPAddress": "172.17.0.2",
fernandohackbart commented 7 years ago
cat /etc/resolv.conf
nameserver 172.17.0.2
nameserver 192.168.1.1
fernandohackbart commented 7 years ago

http://192.168.1.200:10000

screenshot-2017-10-7 bind dns server webmin 1 840 on c30b4588dee4 ubuntu linux 14 04 5

screenshot-2017-10-7 bind dns server webmin 1 840 on c30b4588dee4 ubuntu linux 14 04 5 1

docker:/opt/docker/bind/bind # dig cassandra.bikeride.com @172.17.0.2

; <<>> DiG 9.10.4-P5 <<>> cassandra.bikeride.com @172.17.0.2
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47500
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;cassandra.bikeride.com.                IN      A

;; ANSWER SECTION:
cassandra.bikeride.com. 38400   IN      A       172.18.0.3

;; AUTHORITY SECTION:
bikeride.com.           38400   IN      NS      c7cbd54d5f7e.

;; Query time: 0 msec
;; SERVER: 172.17.0.2#53(172.17.0.2)
;; WHEN: Sat Oct 07 07:50:38 CEST 2017
;; MSG SIZE  rcvd: 93
fernandohackbart commented 7 years ago

To create

docker network ls
docker network create --driver bridge --subnet=172.18.0.0/16 bikeride-network

To remove

docker network rm bikeride-network
fernandohackbart commented 7 years ago
docker pull cassandra
docker run -d --name cassandra --network bikeride-network --ip 172.18.0.3 -p  9042:9042 -i cassandra
docker start cassandra
docker attach cassandra
docker stop cassandra
fernandohackbart commented 7 years ago
fernandohackbart commented 7 years ago

From ouside the host docker run -it --name cassandra-cqlsh --rm cassandra sh -c 'exec cqlsh "192.168.1.200"'

From inside the host docker run -it --name cassandra-cqlsh --link cassandra --network bikeride-network --ip 172.18.0.5 --rm cassandra sh -c 'exec cqlsh "172.18.0.3"'

select * from biker.bikers;
select * from biker.biker_email;
select * from track.tracks;
select * from track.trackwaypoints;
fernandohackbart commented 7 years ago

Using the hostname should work

docker:/opt/docker/bind/bind # docker run -it --name cassandra-cqlsh --link cassandra --network bikeride-network --ip 172.18.0.5 --rm cassandra sh -c 'exec cqlsh "cassandra.bikeride.com"'
Traceback (most recent call last):
  File "/usr/bin/cqlsh.py", line 2428, in <module>
    main(*read_options(sys.argv[1:], os.environ))
  File "/usr/bin/cqlsh.py", line 2407, in main
    encoding=options.encoding)
  File "/usr/bin/cqlsh.py", line 479, in __init__
    load_balancing_policy=WhiteListRoundRobinPolicy([self.hostname]),
  File "/usr/share/cassandra/lib/cassandra-driver-internal-only-3.10.zip/cassandra-driver-3.10/cassandra/policies.py", line 417, in __init__
socket.gaierror: [Errno -2] Name or service not known
fernandohackbart commented 7 years ago

If needed to clean some brtfs volumes lost docker:/var/lib/docker # btrfs subvolume delete btrfs/subvolumes/*

fernandohackbart commented 7 years ago

If need to inspect the network

http://jodies.de/ipcalc

docker network inspect bridge
docker network inspect bikeride-network