0Pricing
Docker & Kubernetes for Developers · レッスン

初めてのコンテナを実行する

ビルド済みのDockerイメージを使ってシンプルなアプリケーションをデプロイし、コマンドラインから操作します。

「初めてのコンテナを実行する」はCoddyKit上の無料Docker & Kubernetes for Developersレッスンです。 これはレッスン3/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはDocker & Kubernetes for Developers学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Docker & Kubernetes for Developersコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Getting Started with Containers

Time to run real containers. You'll launch apps from images, interact with them, and learn the commands that manage their lifecycle.

Launching Containers with 'docker run'

docker run is your launch button: it checks for the image (pulling if needed), creates a container from it, and starts it — all in one command.

Your First Container: Hello World

Run the simplest container there is: hello-world. It prints a message and exits. Try it below.

docker run hello-world

What Just Happened?

Behind that hello-world run, Docker pulled the image, created a container, ran its command, printed the greeting, then stopped. A clean first cycle.

Interacting with Containers

To work inside a container, combine the -it flags: -i keeps STDIN open and -t gives you a terminal, so you can type commands inside it.

Get a Shell in Alpine Linux

Spin up minimal Alpine Linux and drop into its shell to run real Linux commands. Type exit to leave the container.

docker run -it alpine sh

Backgrounding with '-d'

To keep a container running without locking your terminal, use detached mode with the -d flag. Docker prints the container ID and hands control back.

Connecting with Port Mapping

Containers are isolated, so reach a service inside one with port mapping. The -p flag maps a host port to a container port: host:container.

Launching Nginx in Detached Mode

Combine detached mode and port mapping to run Nginx in the background, mapping your host's 8080 to the container's port 80. See the command below.

docker run -d -p 8080:80 nginx

Stopping & Removing Containers

Clean up when you're done: docker stop halts a running container and docker rm removes a stopped one. Grab the ID from docker ps first.

# First, find your Nginx container ID:
docker ps

# Then, stop it:
docker stop <your_nginx_container_id>

# Finally, remove it:
docker rm <your_nginx_container_id>

Quick Check: Interactive Mode

You want to run a container and immediately get a shell inside it to execute commands. Which option would you use with docker run?

Lesson Recap: Running Containers

Recap: docker run launches containers; -it gives a shell, -d runs detached, -p maps ports — plus stop and rm to clean up afterward.

よくある質問

「初めてのコンテナを実行する」レッスンは無料ですか?

はい。「初めてのコンテナを実行する」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Docker & Kubernetes for Developersコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Docker & Kubernetes for Developersコースには全4レッスンが含まれています。

「初めてのコンテナを実行する」で何を学びますか?

ビルド済みのDockerイメージを使ってシンプルなアプリケーションをデプロイし、コマンドラインから操作します。 ブラウザで直接実行するハンズオンコードでDocker & Kubernetes for Developersを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Docker & Kubernetes for Developersを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのDocker & Kubernetes for Developersは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン3/4です。

「初めてのコンテナを実行する」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このDocker & Kubernetes for Developersレッスンでコードを書いて実行できますか?

はい。すべてのDocker & Kubernetes for Developersレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. コンテナ化入門
  2. Dockerのインストールと基本コマンド
  3. 初めてのコンテナを実行する
  4. Dockerイメージとコンテナの管理
← Docker & Kubernetes for Developersに戻る