Close

See How Your Peers Are Moving Forward in the Cloud

New research from CDW can help you build on your success and take the next step.

Jul 01 2020
Software

Get Started on Using Containers with These Docker Tips

Simple guidelines make it easy for an agency to begin using versatile containers for modernization projects.

Containers are all the rage in the software development and DevOps worlds. They increase hardware utilization efficiency, improve infrastructure performance and help with software testing. Docker has revolutionized the container by making them easier to create. Follow these tips to get started.

1. Install Docker Desktop on Your Windows Device

One of the best ways to get started with Docker is locally on your Windows 10 desktop. To do that, you’ll need Docker Desktop for Windows. Docker Desktop is an engine designed to run directly on Windows 10, making it easy to create your first Docker container. Be sure you’re running Windows 10 Pro, Enterprise or Education edition build 1703 or newer with basic input-output system hardware virtualization enabled.

2. Run Commands To Get Your Container Image

Docker containers run from images. Open a command prompt or PowerShell console and type docker run -it alpine sh. This command invokes Docker and runs a command (sh) inside a container (alpine). You will not have the alpine image available locally; Docker will automatically download the image from the Docker Hub, a public repository of Docker container images. Once the image downloads, Docker will run the command sh inside the container, which in this case is a Bash shell. Since the -it switch was used, Docker will interactively run the command, leaving the Bash shell open for other commands.

MORE FROM FEDTECH: Find out how your agency can effectively implement DevOps. 

3. Stop the Container via a Command

If you have one or more containers running, you can stop them using the docker stop command providing the name of the container. If, for example, you have a container called alpine running in the background, you would stop this container by running docker stop alpine. Once stopped, be sure to confirm the container is stopped by running docker ps to ensure no containers are still running.

4. Remove Containers That Have a Specific ID

Once you’re done with a container, you can remove it from your computer by running the docker container rm command. The rm command removes any container matching a specific ID. If, for example, you had an image with an ID of 837d262be033, you would remove this container by running docker container rm 837d262be033.

slavemotion/Getty Images