COver graphics_Containers

Containers Cheat Sheet

Bachir Chihani and Rafael Benevides
English

About

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, you will find:

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

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

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 specific container:
         $ docker logs -f mywild y
        $ docker logs -f [container-name]

Related Cheat sheets