0Pricing
Docker & Kubernetes for Developers · Lekcja

Uruchamianie pierwszego kontenera

Wdróż prostą aplikację za pomocą gotowego obrazu Docker i korzystaj z niej z poziomu wiersza poleceń.

Uruchamianie pierwszego kontenera to bezpłatna lekcja Docker & Kubernetes for Developers na CoddyKit. To lekcja 3 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej Docker & Kubernetes for Developers, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs Docker & Kubernetes for Developers zawiera 4 lekcji w sumie.

Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.

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.

Często zadawane pytania

Czy lekcja „Uruchamianie pierwszego kontenera” jest bezpłatna?

Tak — pełny tekst „Uruchamianie pierwszego kontenera” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu Docker & Kubernetes for Developers, przejdź na CoddyKit PRO. Kurs Docker & Kubernetes for Developers zawiera 4 lekcji w sumie.

Co nauczysz się w „Uruchamianie pierwszego kontenera”?

Wdróż prostą aplikację za pomocą gotowego obrazu Docker i korzystaj z niej z poziomu wiersza poleceń. Ćwiczysz Docker & Kubernetes for Developers z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.

Czy potrzebuję doświadczenia, aby zacząć Docker & Kubernetes for Developers?

Nie wymagamy żadnego doświadczenia. Docker & Kubernetes for Developers w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 3 z 4.

Ile czasu zajmuje lekcja „Uruchamianie pierwszego kontenera”?

Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.

Czy mogę pisać i uruchamiać kod w tej lekcji Docker & Kubernetes for Developers?

Tak. Każda lekcja Docker & Kubernetes for Developers zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.

Wszystkie lekcje w tym kursie

  1. Wprowadzenie do konteneryzacji
  2. Instalacja Dockera i podstawowe polecenia
  3. Uruchamianie pierwszego kontenera
  4. Zarządzanie obrazami i kontenerami Docker
← Powrót do Docker & Kubernetes for Developers