Cheat Sheet

Containers Cheat Sheet

  • By
    Bachir Chihani and Rafael Benevides
  • Published: 2017-03-24
Containers Cheat Sheet
Containers Cheat Sheet

Easy to use shortcuts for developers

Whether you are new to Containers or have experience, you may find yourself encountering tasks you haven’t done lately. That is where the cheat sheet can help.

In this Containers Cheat Sheet find:

  • Introduction to Container architecture
  • Engine, image, registry, volume, related commands
  • Example of running a web server container

Save this cheat sheet or print to take it with you.

Cheat Sheet Excerpt

  1. docker CLI
    1. Container Related Commands
      docker [CMD] [OPTS] [CONTAINER]

      Examples
      All examples shown work in Red Hat Enterprise Linux
       
      1. Run a container in interactive mode:
        #Run a bash shell inside an image
        $ docker run -it rhel7/rhel bash
        #Check the release inside a container
        [root@.../]# cat /etc/redhat-release

         
      2. Run a container in detached mode:
        $ docker run --name mywild y -d -p 8080:8080 jboss/wild y
         
      3. Run a detached container in a previously created container network:
         $ docker network create mynetwork
        $ docker run --name mywild y-net -d --net mynetwork
         -p 8080:8080 jboss/wild y

         
      4. Run a detached container mounting a local folder inside the container:
         $ docker run --name mywild y-volume -d
        -v myfolder/:/opt/jboss/wild y/standalone/deployments/
        -p 8080:8080 jboss/wild yjboss/wild y

         
      5. Follow the logs of a speci c container:
         $ docker logs -f mywild y
        $ docker logs -f [container-name|container-id]
Want to see more? Get the full cheat sheet.

Comments