Play With Docker
-download cassandra docker image
docker pull cassandra
docker image pull cassandra
docker container run cassandra
docker run -ti cassandra /bin/sh
-run cassandra docker image
docker run -d cassandra
-d -> run container in background and print container ID
docker run --name cass1 -d cassandra
--name -> set container name
first machine
docker run --name cass1 -d -e CASSANDRA_BROADCAST_ADDRESS=192.168.10.42 -p 7000:7000 cassandra
second machine
docker run --name cass2 -d -e CASSANDRA_BROADCAST_ADDRESS=192.168.10.43 -p 7000:7000 -e CASSANDRA_SEEDS=192.168.10.42 cassandra
BACKUP DOCKER IMAGE
To backup docker images, use the docker save command that will produce a tar archive that can be used later on to create a new docker image with the docker load command.
docker save cassandra > cassandra-docker-image-backup.tar
BACKUP DOCKER CONTAINER
You can backup a docker container by different means;
-by committing a new docker image based on the docker container current state using the docker commit command
-by exporting the docker container file system as a tar archive using the docker export command. You can later on create a new docker image from that tar archive with the docker import command.
Be aware that those commands will only backup the docker container layered file system. This excludes the data volumes.
docker export cass > cass-container-backup.tar
SIMPLE DOCKER COMPOSE START
docker-compose up -d
By default, Compose looks for docker-compose.yml. If you have named you file differently you must use the -f flag. Example command follows: docker-compose -f docker-compose-different.yml up -d
docker pull cassandra
docker image pull cassandra
docker container run cassandra
docker run -ti cassandra /bin/sh
-run cassandra docker image
docker run -d cassandra
-d -> run container in background and print container ID
docker run --name cass1 -d cassandra
--name -> set container name
first machine
docker run --name cass1 -d -e CASSANDRA_BROADCAST_ADDRESS=192.168.10.42 -p 7000:7000 cassandra
second machine
docker run --name cass2 -d -e CASSANDRA_BROADCAST_ADDRESS=192.168.10.43 -p 7000:7000 -e CASSANDRA_SEEDS=192.168.10.42 cassandra
BACKUP DOCKER IMAGE
To backup docker images, use the docker save command that will produce a tar archive that can be used later on to create a new docker image with the docker load command.
docker save cassandra > cassandra-docker-image-backup.tar
BACKUP DOCKER CONTAINER
You can backup a docker container by different means;
-by committing a new docker image based on the docker container current state using the docker commit command
-by exporting the docker container file system as a tar archive using the docker export command. You can later on create a new docker image from that tar archive with the docker import command.
Be aware that those commands will only backup the docker container layered file system. This excludes the data volumes.
docker export cass > cass-container-backup.tar
SIMPLE DOCKER COMPOSE START
docker-compose up -d
By default, Compose looks for docker-compose.yml. If you have named you file differently you must use the -f flag. Example command follows: docker-compose -f docker-compose-different.yml up -d