BIN
assets/images/help/codespaces/codespaces-rebuild-full.png
Normal file
BIN
assets/images/help/codespaces/codespaces-rebuild-full.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 16 KiB |
@@ -213,6 +213,8 @@ const article: PlaygroundArticleT = {
|
||||
|
||||
Rebuilding inside your codespace ensures your changes work as expected before you commit the changes to the repository. If something does result in a failure, you’ll be placed in a codespace with a recovery container that you can rebuild from to keep adjusting your container.
|
||||
|
||||
You may occasionally want to perform a full rebuild to clear your cache and rebuild your container with fresh images. For more information, see "[Performing a full rebuild of a container](/codespaces/codespaces-reference/performing-a-full-rebuild-of-a-container)."
|
||||
|
||||
5. Check your changes were successfully applied by verifying the "Code Spell Checker" extension was installed.
|
||||
|
||||

|
||||
|
||||
@@ -200,6 +200,8 @@ const article: PlaygroundArticleT = {
|
||||

|
||||
|
||||
Rebuilding inside your codespace ensures your changes work as expected before you commit the changes to the repository. If something does result in a failure, you’ll be placed in a codespace with a recovery container that you can rebuild from to keep adjusting your container.
|
||||
|
||||
You may occasionally want to perform a full rebuild to clear your cache and rebuild your container with fresh images. For more information, see "[Performing a full rebuild of a container](/codespaces/codespaces-reference/performing-a-full-rebuild-of-a-container)."
|
||||
`,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -199,6 +199,8 @@ const article: PlaygroundArticleT = {
|
||||

|
||||
|
||||
Rebuilding inside your codespace ensures your changes work as expected before you commit the changes to the repository. If something does result in a failure, you’ll be placed in a codespace with a recovery container that you can rebuild from to keep adjusting your container.
|
||||
|
||||
You may occasionally want to perform a full rebuild to clear your cache and rebuild your container with fresh images. For more information, see "[Performing a full rebuild of a container](/codespaces/codespaces-reference/performing-a-full-rebuild-of-a-container)."
|
||||
`,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -215,6 +215,8 @@ const article: PlaygroundArticleT = {
|
||||
|
||||
Rebuilding inside your codespace ensures your changes work as expected before you commit the changes to the repository. If something does result in a failure, you’ll be placed in a codespace with a recovery container that you can rebuild from to keep adjusting your container.
|
||||
|
||||
You may occasionally want to perform a full rebuild to clear your cache and rebuild your container with fresh images. For more information, see "[Performing a full rebuild of a container](/codespaces/codespaces-reference/performing-a-full-rebuild-of-a-container)."
|
||||
|
||||
5. Check your changes were successfully applied by verifying the Code Spell Checker and Flask Snippet extensions were installed.
|
||||
|
||||

|
||||
|
||||
@@ -10,6 +10,7 @@ children:
|
||||
- /using-the-github-codespaces-plugin-for-jetbrains
|
||||
- /using-the-vs-code-command-palette-in-codespaces
|
||||
- /security-in-github-codespaces
|
||||
- /performing-a-full-rebuild-of-a-container
|
||||
- /disaster-recovery-for-github-codespaces
|
||||
---
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
title: Performing a full rebuild of a container
|
||||
intro: If you are low on disk space, or want to ensure your dev container configuration will work in new codespaces, you can perform a full rebuild of a container.
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghec: '*'
|
||||
type: reference
|
||||
topics:
|
||||
- Codespaces
|
||||
shortTitle: Full rebuilds
|
||||
---
|
||||
|
||||
## About rebuilding a container
|
||||
|
||||
When you work in a codespace, your development environment is a Docker container that runs on a virtual machine. If you make changes to your dev container configuration from within a codespace, and you want to apply those changes to the current codespace, you need to rebuild the container.
|
||||
|
||||
By default, when you rebuild a container, {% data variables.product.prodname_github_codespaces %} will speed up the build process by reusing cached images from previous builds of the container. This is usually the quickest way to implement changes to your dev container configuration, for the following reasons.
|
||||
- {% data variables.product.prodname_github_codespaces %} can reuse images in your cache rather than repulling them from container registries.
|
||||
- The parts of your dev container configuration that define how the container is built, such as dev container features and Dockerfile instructions, may have already been implemented in image layers in your cache, so you won't need to wait for these processes to run again. (However, commands in your configuration that run after the container is built, such as `onCreateCommand`, will run again.)
|
||||
|
||||
Occasionally, you may want to perform a full rebuild of your container. With a full rebuild, {% data variables.product.prodname_github_codespaces %} cleans all Docker containers, images, and volumes from the cache, then rebuilds your container with newly pulled images. All the setup defined in your configuration will run again, generating new image layers. You may want to perform a full rebuild after many iterations of rebuilding your container with cached images, in situations such as the following.
|
||||
|
||||
- You want to ensure that the setup defined in your configuration is not dependent on cached images, and will run as required when someone creates a new codespace based on the configuration. For example, a dependency may have been removed from the base image since it was last pulled into your codespace.
|
||||
- You want to free up the disk space used by your cache, for example if you are low on disk space or want to minimize storage charges. Your image cache might be using a significant amount of disk space if you've changed your base image multiple times, if you've made a large number of iterative changes to your configuration, or if you're running multiple containers with Docker Compose.
|
||||
|
||||
## Performing a full rebuild
|
||||
|
||||
You can perform a full rebuild in {% data variables.product.prodname_vscode %}.
|
||||
|
||||
{% data reusables.codespaces.command-pallette %}
|
||||
1. Start typing "Rebuild" and select **Codespaces: Full Rebuild Container**.
|
||||
|
||||

|
||||
|
||||
## Persisting data over a full rebuild
|
||||
|
||||
Any files and folders contained in the `/workspaces` directory of your codespace are always persisted over a rebuild. You do not need to change any settings or add any configuration to retain the contents of this directory over a full rebuild.
|
||||
|
||||
If you want to preserve files outside the `/workspaces` directory over a full rebuild, you can create, at the desired location in the container, a symbolic link (symlink) to the persistent directory. For example, in your `/workspaces/.devcontainer` directory, you can create a `config` directory that will be preserved across a rebuild. You can then symlink the `config` directory and its contents as a `postCreateCommand` in your `devcontainer.json` file.
|
||||
|
||||
```json
|
||||
{
|
||||
"image": "mcr.microsoft.com/vscode/devcontainers/base:alpine",
|
||||
"postCreateCommand": ".devcontainer/postCreate.sh"
|
||||
}
|
||||
```
|
||||
|
||||
In the example `postCreate.sh` file below, the contents of the `config` directory are symbolically linked to the home directory.
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
ln -sf $PWD/.devcontainer/config $HOME/config && set +x
|
||||
```
|
||||
|
||||
## Further reading
|
||||
- [Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers)
|
||||
@@ -58,6 +58,8 @@ To rebuild your container, [access the {% data variables.product.prodname_vscode
|
||||
|
||||

|
||||
|
||||
{% data reusables.codespaces.full-rebuild-tip %}
|
||||
|
||||
### Codespaces logs
|
||||
|
||||
You can use the {% data variables.product.prodname_vscode_command_palette_shortname %} to access the codespace creation logs, or you can use it export all logs.
|
||||
|
||||
@@ -40,25 +40,9 @@ When a codespace times out, your data is preserved from the last time your chang
|
||||
|
||||
## Rebuilding a codespace
|
||||
|
||||
You can rebuild your codespace to restore a clean state as if you had created a new codespace. For most uses, you can create a new codespace as an alternative to rebuilding a codespace. You are most likely to rebuild a codespace to implement changes to your dev container configuration. When you rebuild a codespace, any Docker containers, images, volumes, and caches are cleaned, then the codespace is rebuilt.
|
||||
You can rebuild your codespace to implement changes to your dev container configuration. For most uses, you can create a new codespace as an alternative to rebuilding a codespace. By default, when you rebuild your codespace, {% data variables.product.prodname_github_codespaces %} will reuse images from your cache to speed up the rebuild process. Alternatively, you can perform a full rebuild, which clears your cache and rebuilds the container with fresh images.
|
||||
|
||||
If you need any of this data to persist over a rebuild, you can create, at the desired location in the container, a symbolic link (symlink) to the persistent directory. For example, in your `.devcontainer` directory, you can create a `config` directory that will be preserved across a rebuild. You can then symlink the `config` directory and its contents as a `postCreateCommand` in your `devcontainer.json` file.
|
||||
|
||||
```json
|
||||
{
|
||||
"image": "mcr.microsoft.com/vscode/devcontainers/base:alpine",
|
||||
"postCreateCommand": ".devcontainer/postCreate.sh"
|
||||
}
|
||||
```
|
||||
|
||||
In the example `postCreate.sh` file below, the contents of the `config` directory are symbolically linked to the home directory.
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
ln -sf $PWD/.devcontainer/config $HOME/config && set +x
|
||||
```
|
||||
|
||||
For more information, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#applying-configuration-changes-to-a-codespace)."
|
||||
For more information, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#applying-configuration-changes-to-a-codespace)" and "[Performing a full rebuild of a container](/codespaces/codespaces-reference/performing-a-full-rebuild-of-a-container)."
|
||||
|
||||
## Stopping a codespace
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ To add features in {% data variables.product.prodname_vscode_shortname %} while
|
||||
|
||||
{% endnote %}
|
||||
|
||||
1. In {% data variables.product.prodname_vscode_shortname %}, open the Command Palette with <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Mac) or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux).
|
||||
{% data reusables.codespaces.command-pallette %}
|
||||
2. Start typing "Configure" and select **Codespaces: Configure Dev Container Features**.
|
||||
|
||||

|
||||
|
||||
@@ -93,4 +93,4 @@ This codespace is currently running in recovery mode due to a container error.
|
||||
```
|
||||
Review the creation logs and update the dev container configuration as needed. For more information, see "[{% data variables.product.prodname_github_codespaces %} logs](/codespaces/troubleshooting/github-codespaces-logs)."
|
||||
|
||||
You can then try restarting the codespace, or rebuilding the container. For more information, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#applying-configuration-changes-to-a-codespace)."
|
||||
You can then try restarting the codespace, or rebuilding the container. For more information on rebuilding the container, see "[Introduction to dev containers](/codespaces/setting-up-your-project-for-codespaces/introduction-to-dev-containers#applying-configuration-changes-to-a-codespace)."
|
||||
|
||||
1
data/reusables/codespaces/command-pallette.md
Normal file
1
data/reusables/codespaces/command-pallette.md
Normal file
@@ -0,0 +1 @@
|
||||
1. Access the {% data variables.product.prodname_vscode_command_palette_shortname %} with <kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd> (Mac) or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux).
|
||||
5
data/reusables/codespaces/full-rebuild-tip.md
Normal file
5
data/reusables/codespaces/full-rebuild-tip.md
Normal file
@@ -0,0 +1,5 @@
|
||||
{% tip %}
|
||||
|
||||
**Tip:** You may occasionally want to perform a full rebuild to clear your cache and rebuild your container with fresh images. For more information, see "[Performing a full rebuild of a container](/codespaces/codespaces-reference/performing-a-full-rebuild-of-a-container)."
|
||||
|
||||
{% endtip %}
|
||||
@@ -1,3 +1,5 @@
|
||||
1. Access the {% data variables.product.prodname_vscode_command_palette_shortname %} (<kbd>Shift</kbd>+<kbd>Command</kbd>+<kbd>P</kbd> (Mac) / <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux)), then start typing "rebuild". Select **Codespaces: Rebuild Container**.
|
||||
|
||||

|
||||

|
||||
|
||||
{% indented_data_reference reusables.codespaces.full-rebuild-tip %}
|
||||
|
||||
Reference in New Issue
Block a user