To automatically delete Docker containers and images older than 15 days, we can set up a cron job that runs a script at specified intervals.
Create a file named docker-cleanup.sh
with the following content:
#!/bin/bash
Go to this link to get your desired version of the OC client tool. I have choosen the latest version available in July, 2020.
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.8
python --version
python3 --version
sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
sudo apt install python3-pip
In GCP console, on the top right toolbar, click the Open Cloud Shell button.
Click Continue.
For convenience, place the zone that Qwiklabs assigned you to into an environment variable called MY_ZONE. At the Cloud Shell prompt, type this partial command:
Assuming that the following environment variables are set:
KAFKA_HOME
where Kafka is installed on local machine (e.g. /opt/kafka
)ZK_HOSTS
identifies running zookeeper ensemble, e.g. ZK_HOSTS=192.168.0.99:2181
KAFKA_BROKERS
identifies running Kafka brokers, e.g. KAFKA_BROKERS=192.168.0.99:9092
Start Zookepper and Kafka servers
Displaying Basic System Information on Linux Shell
uname
Output:
Result of uname command