DOCKER TUTORIAL - CS50 on Twitch, EP. 23

DOCKER TUTORIAL – CS50 on Twitch, EP. 23


docker on shared hosting

Join CS50’s David J. Malan for a tour of Docker, a piece of software that utilizes “containers” for making development and deployment of applications all the easier, compared to methods like vhosting of yesteryear and more current methods like virtualization.

Co-hosted by Colton Ogden. Tune in live on twitch.tv/cs50tv and become a part of the live chat.

This is CS50 on Twitch.

22 thoughts on “DOCKER TUTORIAL – CS50 on Twitch, EP. 23

  1. i want the answer of this question please
    (Create A small (Static or dynamic) Web Application that get booted using docker. The Code of Both the App and the Docker File will be delivered using your GitHub Page)

  2. With all my respect to Professor, this video mixes containers with images which is not right, cause it actually confused me and surely will confuse any docker newbie like myself.

    $ docker build .
    this command builds an IMAGE and NOT a container!

    $ docker run -it [image name] (e.g. docker run -it cs50/cli)
    this command runs NEW container using (or better to say «on top of») your image (btw -it means «take me to the shell of this new container»)

    Do containers persist? Here’s the answer in Docker’s FAQ —> https://docs.docker.com/engine/faq/
    Q: Do I lose my data when the container exits?
    A: Not at all! Any data that your application writes to disk gets preserved in its container until you explicitly delete the container. The file system for the container persists even after the container halts.
    This means you do not need to reinstall anything and all your data is safe in the container.

    Indeed if you need to flush everything, you can delete your old container and do «Docker run» again.

    See all of your containers (stopped and running) like this:
    $ docker ps –all
    you will see container names in the first column

    if you want to start your stopped container and access it’s shell right away run this:
    $ docker start -ia [container name] (e.g. docker start -ia 7dbd85cec821)

    or if container is running you may just attach to it
    $ docker attach [container name] (e.g. docker attach 7dbd85cec821)

    btw you can rename container (not image) like this
    $ docker rename [container name] cs50 (e.g. docker rename 7dbd85cec821 cs50)

    UPDATE: After getting this part I still had several questions:
    – Why is it called «Docker» after all?
    – How much space does a container take? (e.g. What if i run 1000 containers?)
    – Anyways.. I still don’t get it, what’s the difference between VMs and docker? Is it just faster?

    All of the above goes together.
    Docker is a piece of software first of all and what it does is docks your containers onto your images (just like on cargo ships ships). No, containers does not take much space on your hard drive. When you create a container Docker just writes down the difference between an image and container created on top of this image. So when you don’t do any changes to the container the difference is zero, the container is empty. if it’s 1000 empty containers its just 1000 diff files and that’s not a lot of space. To run those docker shares one image between them and simultaneously reads its data and uses resources.

    «So, let's say you have a 1 GB container image; if you wanted to use a full VM, you would need to have 1 GB times x number of VMs you want. With Docker and AuFS you can share the bulk of the 1 GB between all the containers and if you have 1000 containers you still might only have a little over 1 GB of space for the containers OS (assuming they are all running the same OS image).» read this for more info —> https://stackoverflow.com/questions/16047306/how-is-docker-different-from-a-virtual-machine

    Docker is just a fancy way to run a process, not a virtual machine.

    BUT:
    While Linux can create containers natively, both Docker for Mac and Windows use Linux VMs to run the containers. Docker for Mac OS X uses hypervisor (xhyve) which is native to mac, to run Linux (a lightweight distro just to run docker) on top of it. The Linux VM that Docker runs in Mac is read-only. However, you can bash into it by running:
    screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty

    Thanks for the video anyways, cause it helped me to figure all this out 🙂

  3. Joshua Aguilar
    1 second ago

    How to save and quit the vi or vim text editor 🙂
    To save and quit the vi or vim editor with saving any changes you have made:
    (press I to start inserting code)
    If you are currently in insert or append mode, press Esc key.
    Press : (colon). The cursor should reappear at the lower left corner of the screen beside a colon prompt.
    Enter the following command (type 😡 and press Enter key):

    I do not think you should apologize for looking up syntax, it was my favorite part. It shows the life of real developers. It teaches how to look things up and helps people understand that everybody does not always know the perfect syntax all the time. Great share as always

  4. The whole premise is based on a falsehood. The cost of virtualizing an entire OS is extremely low (pennies/day) so you're adding complexity to save a few dollars, which is really stupid. (And the cost is dropping every day.) Running a business, you don't want to add new software unless there's a significant benefit. Most businesses will not save more than a few dollars by using Docker. So Docker is a waste of time unless you have 1000s of VMs, which is extremely rare IRL.

Leave a Reply

Your email address will not be published. Required fields are marked *