Skip to main content

My Docker crash course

Docker has taken the container world by storm. If you understood LXC from the previous post, Docker will feel like a polished toolkit built on similar ideas. This post gives you a quick start so you can begin running containers in minutes.

First, install Docker on your system. On Linux you can install it via your distribution’s package manager. On Windows and macOS you can download Docker Desktop from the official Docker website. Once installed, verify it works:
docker --version
If you see version information, you are ready.

Run your first container:
docker run hello-world
Docker will pull the image if it does not exist locally and then execute it. Congratulations. You just ran your first container.

To see running containers:
docker ps
To see all containers including stopped ones:
docker ps -a
To run an interactive Ubuntu container:
docker run -it ubuntu /bin/bash
You are now inside the container shell.

To exit:
exit
To stop a running container:
docker stop 
To remove a container:
docker rm 
To remove an image:
docker rmi 
Docker makes container management simple and repeatable. Once you start using it for development environments or microservices, you may wonder how you ever worked without it.

Happy Dockering.

Disclaimer: If you follow the information here, there is no warranty, I am not liable if it deletes your data, gets you hacked, burns your house down or anything else. If you follow the information contained here you do so entirely at your own risk.  My views and opinions are my own and not necessarily represent the views of my employer.

© Raheel Hameed and www.raheelhameed.com, 2017. Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to author and this website with appropriate and specific direction to the original content.
Disclaimer: If you follow the information here, there is no warranty, I am not liable if it deletes your data, gets you hacked, burns your house down or anything else. If you follow the information contained here you do so entirely at your own risk.  My views and opinions are my own and not necessarily represent the views of my current or former employers.

© Raheel Hameed and www.raheelhameed.com, 2017. Unauthorized use and/or duplication of this material without express and written permission from this site’s author and/or owner is strictly prohibited. Excerpts and links may be used, provided that full and clear credit is given to author and this website with appropriate and specific direction to the original content.

Comments

Popular posts from this blog

Using XPerf

XPerf comes with Windows SDK. You can get it from MSFT website. During installation there is an option to install just the performance tools should you want only perf tools and not the whole SDK. To collect a trace from administrator command line: Begin your workload. xperf -on base+cswitch+power -stackwalk Profile -f c:\kernel.etl  Let the workload execute for a while. xperf -stop  If you have previously created c:\merged.etl, delete it. xperf -merge c:\kernel.etl c:\merged.etl  Now, before you can view your trace in UI, setup your symbol path: set _NT_SYMBOL_PATH=<path to PDB files>  You should now be all set to launch the viewer: xperf c:\merged.etl (this launches the viewer)  On the UI, there are several different type of graphs for various measurements. From inside the Graph menu, you can enable these views: CPU Usage by Process. CPU Sampling by CPU. Stack Counts by type. Happy XPerf-ing!

My MongoDB crash course

MongoDB is a NoSQL database that stores data in flexible JSON like documents. Unlike relational databases, MongoDB does not require a fixed schema. This makes it very convenient for applications where structure may evolve over time. First install MongoDB. On Ubuntu you typically add the official MongoDB repository and then install: sudo apt install mongodb Once installed, check service status: sudo systemctl status mongodb If it is not running, start it: sudo systemctl start mongodb To access MongoDB shell: mongo You should now be inside the MongoDB interactive shell. To show databases: show dbs To create or switch to a database: use mydb MongoDB creates the database automatically when you first store data. To insert a document: db.users.insertOne({ name: "John", email: "[john@example.com](mailto:john@example.com)", age: 30 }) To find documents: db.users.find() To pretty print results: db.users.find().pretty() To update a docum...

My AWS S3 crash course

This post aims to be your quick start guide to AWS S3, ie. Amazon Web Services. Follow along and you'll feel like you just had a roller coaster ride in AWS S3 world. First of all, get a free AWS account. AWS includes many services and as mentioned above I will only cover S3 here. You may be wondering what is S3. In simple words S3 is Amazon's cloud backup service. Their Free tier is limited, and any usage beyond the limit will incur charges. So make sure you read through the pricing structure and understand it. Charges can accumulate fast if you don't pay attention or are not careful of your usage. You have been warned. You and only you are responsible for your bills. See disclaimer at the end of this post. Your reading of this post implies your understanding and agreement to the disclaimer. Once you are equipped with an AWS account, login to it and launch AWS management console. Create a Bucket In S3's terminology, a bucket is a collection of files or objects t...